Compiling FET on Mac OS [updated x3]

Started by Darren McDonald, August 08, 2016, 03:51:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Darren McDonald

[Update 3: Instructions for creating universal (Mac silicon and Intel processor) versions when compiling on Mac silicon processors were added, and version numbers were updated.]

[Update 2: The directory structure of Qt has recently changed with Qt versions 6.1.3 and 6.2.0, so I've updated the terminal commands accordingly.]

[Update: It's now 2021, and happily the instructions below are still correct. However, I thought it was time to update the formatting of these instructions, and I've added some additional information as well.]

I finally had a chance to dive in and try to compiling FET on the Mac (partly just for fun, but also in order to hopefully solve a few minor bugs that had appeared on the most recently available Mac executable—happily, those bugs are now gone!).

I am by no means a programmer, so I thought it might be helpful to list the steps required to compile FET on a Mac (from essentially a clean install), for anyone else with limited programming experience who's interested in trying to compile FET for the Mac. This was all done on a 2008 MacBook Pro, running OS X El Capitan 10.11.6. [Update: These instructions have also been tested up to macOS Monterey, and on newer Macs, including those with an Apple processor.]

1. Install Xcode (the current version is 13.2.1) from the Mac App Store. (Once installed, you'll need to open the Xcode app to finish the installation.)

2. Install Qt (the current version is 6.2.3) from https://www.qt.io. The default install location is /Users/YOURUSERNAME/Qt, and you can create a (free) Qt account, or just skip past that screen. [Update: if you're just using Qt for FET, you should select to "download for open source".]

3. Download the latest version of the FET source files (the current version is 6.3.0) from https://lalescu.ro/liviu/fet/download.html. The default download location is /Users/YOURUSERNAME/Downloads, and you'll need to double-click the downloaded zip file to produce the folder of files needed to compile.

4. Open the Terminal app and type the following, replacing YOURUSERNAME with the username of your Mac account (which will be the string between "~" and "$" in the Terminal app).

The instructions below are written for the current version of FET (6.3.0) and the current version of Qt (6.2.3), and assume that both Qt and the downloaded FET folder are located in their default locations, /Users/YOURUSERNAME/Qt for Qt and /Users/YOURUSERNAME/Downloads for FET. You will need to press enter after you type each of the commands below. Of course, you will also need to update the version numbers in the commands below as FET and Qt are updated.

cd /Users/YOURUSERNAME/Downloads/fet-6.3.0

/Users/YOURUSERNAME/Qt/6.2.3/macos/bin/qmake -r -spec /Users/YOURUSERNAME/Qt/6.2.3/macos/mkspecs/macx-clang

If you are compiling on a computer with Mac silicon (e.g., an M1 MacBook, etc.) and want to create a version that will run on Intel processors as well, instead of the command above, use

/Users/YOURUSERNAME/Qt/6.2.3/macos/bin/qmake -r -spec /Users/YOURUSERNAME/Qt/6.2.3/macos/mkspecs/macx-clang QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"


make -j 4

Now you'll need to wait a while—about 15 minutes on a 2014 MacBook Pro 15". Faster results may be possible by using, for example, make -j 8 instead—with the number at the end of the command set to match the number of processors you've got in your computer. (Not sure how many processors you've got? Type sysctl -n hw.ncpu in the terminal, the number that appears will be the number of processors you've got.)

You now have a working version of FET, but one which will only run on a Mac with Qt installed. To create an app that will run on other Macs, complete step 5.

5. Open the Terminal app and type the following:

cd /Users/YOURUSERNAME/Qt/6.2.3/macos/bin/

./macdeployqt /Users/YOURUSERNAME/Downloads/fet-6.3.0/fet.app

6. If you want to use FET in a language other than the default, you'll need to move the translation files into the appropriate location. The files you need to move can be found in /Users/YOURUSERNAME/Downloads/fet-6.3.0/translations—you'll want to move all of the files ending with .qm to a new location. Open a new Finder window and right-click on the FET.app you've just created in /Users/YOURUSERNAME/Downloads, and select Show Package Contents. Then open the Contents folder, and finally open the MacOS folder within Contents. This is where you should move the .qm files. Once these have been moved, you switch FET languages within the FET app as usual.

That's it!

Liviu Lalescu

#1
Thank you! Maybe "make -j 2" will be twice faster if on two cores, and you don't need a Qt account - you can press Skip.

I added your Step 1. to the FET README, because I think the other steps are already present. Let me know if you think otherwise.

Darren McDonald

Thanks for the feedback! I've updated the steps as you've suggested, and when the next version of FET comes out I'll try "make -j 2" on that system.

I suspect a custom install of Qt would also help to speed things up when preparing to compile FET (it's a big installation at around 13 GB, and many of the components seemed to be for Android/iOS purposes—that's one of the reasons I didn't do this on my newer Mac).

Liviu Lalescu

Thank you, Darren, for the update (that you did on 2021-09-11). I updated the FET README file. The only minor thing is that I believe you need a Qt account (free) to install Qt.

gt

It should be great to get similar instruction to compile the last version of "Fet to Excel by Roberto Trevisan" for MacOS (if possible)

Darren McDonald

Quote from: gt on October 05, 2021, 10:53:42 AM
It should be great to get similar instruction to compile the last version of "Fet to Excel by Roberto Trevisan" for MacOS (if possible)

I'm afraid I don't use the FET to Excel program, so I'm not able to help here. Sorry!

Darren McDonald

The instructions here have been updated with steps for compiling universal (Mac silicon and Intel processor) versions of FET using a computer with Mac silicon.

Liviu Lalescu

Thank you, Darren! It's good that you found the method for universal executables. I updated the FET README file (the only change is this:

QuoteIf you are compiling on a computer with Mac silicon (e.g., an M1 MacBook, etc.) and want to create a version that will run on Intel processors as well, instead of the command above, use

Code Select
/Users/YOURUSERNAME/Qt/6.2.3/macos/bin/qmake -r -spec /Users/YOURUSERNAME/Qt/6.2.3/macos/mkspecs/macx-clang QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"

?)

hirama

Hello & thanks for the replay

Sorry but i was trying to install Xcode it says ( Xcode can't be installed on "Macintosh HD" because macOS version 12.5 or later is required. )

What should i do?

Best regards

Volker Dirr

You should update your OS.
If you can't update to a newer operating system, download an old xcode version:
https://xcodereleases.com/