Download and install Qt Creator. Go to the Qt Creator official download site to download this software. Near the middle of the page, there is a gray bar of links; in that bar, click the link named 'Qt Offline Installers'. Now scroll down to 'OS X Host', and choose Qt 5.5.1 for Mac (588 MB). (The exact version may change over time, but make. Qt Designer vs. Qt Designer normally ships as a part of Qt Creator. This is Qt's official editor and lets you do a lot more than just graphically design user interfaces. It is a full-fledged and very powerful C IDE. This power comes at a price however: The download for Qt Creator is gigabytes in size!
How to use Qt Creator for software development on macOS without having to install Xcode
Justification
Qt refuses to install on macOS unless Apple's Xcode is installed beforehand.This is unfortunate because:
Downloading and installing the command line utilities without Xcode saves time and bandwidth,and means that valuable SSD storage space is kept for better uses.
¹ I believe the full Xcode IDE is required for developing iOS apps with Qt(i.e. apps for iPads and iPhones)but I'm not sure about this as I'm not an iOS developer.
InstructionsSummary
![]()
All done!
Step-by-stepStep 1 - Download & install Xcode's Command Line Tools
Open a Terminal (press Cmd+Space and type 'Terminal') and enter this command:
Press the Return key to execute the command.
Step 2 - Download & install Qt and Qt Creator
Packages are available for MacPorts and Homebrew,but it's usually best to get it straight from the source:
The Online Installer is probably the best option for most people.
Tip: when you run the Online Installer it will prompt you to log in with Qt online credentials,but open-source users can skip this step without entering anything.
At a certain point during the install the following error message will appear:
You need to install Xcode version 5.0.0.Download Xcode from https://developer.apple.com/xcode
Press 'OK' or ESC to dismiss the dialog. It will come back again.Keep pressing 'OK' or ESC and the dialog will eventually go away for good!You have to dismiss the dialog a total of 12 times before you can continue.
Hint: Once Qt is installed you can delete the installer as you won't need it again.If you want to update or remove Qt you have to use the MaintenanceTool in the Qt directory.
Step 3 - Make sure Qt Creator uses the correct C++ Compiler.
Run this command in a Terminal windows to find out where Xcode's Command Line Tools are installed:
The result will probably be
/Library/Developer/CommandLineTools ,unless Xcode is installed. Whatever the result,you need to append '/usr/bin' to get something along the lines of:
Run Qt Creator once with this location stored in your
${PATH} environment variable:
Go to Qt Creator > Preferences > Build & Run > Kits and select a build kit (e.g.
Desktop Qt 5.. ).
Check that the C and C++ compilers are the ones from the command line tools,not the default compilers in
/usr/bin .Also check that clang is used for both compilers, not gcc .
Qt Creator will remember the locations of the compilers,so in future you can launch Qt Creator the normal way via Spotlight.
Step 4 - Update some QMake files (only necessary for Qt versions older than Qt 5.9.2)
The
xcrun or xcodebuild utilities can be used to show where Xcode's Command Line Tools are installed,but only xcrun works when Xcode itself is not installed.
Qt 5.9.2 and later
Recent Qt versions use
xcrun already, so there's nothing left for you to do!
Qt 5.9.1 and older
Older Qt versions try to use
xcodebuild to find out where the utilities are installed.This fails with the following error message unless Xcode is installed:
Project ERROR: Could not resolve SDK Path for 'macosx'Error while parsing file
<filename.pro> . Giving up.
You need to tell QMake to use
xcrun instead.
Open a Terminal and change directory to where the QMake files are stored.
Now copy and paste these new commands into the same Terminal windowto create backup copies of some files:
Press the Return key after the final command.
If that all went OK then run these commands to update the files:
You can see the changes made here if you are interested.
Reusing this materialReferencing
Qt without Xcode how-to by Peter Jonas (shoogle) / CC BY 4.0
License
This work is licensed under a Creative Commons Attribution 4.0 International License.
Two earlier blog posts (1) (2) covered how to set up Qt and Qt Creator on Windows and Linux systems. Let's look at installation on the remaining major desktop platform, macOS.
Thanks to the unified Qt installer, the process is very similar to that on Windows and Linux, so we'll just cover some of the differences and highlights of the Mac install.
Assumptions and PrerequisitesQt Creator Free
For this example we'll install Qt 5.7.1, which is supported on macOS version 10.8 and later.
The C++ compiler used by Qt on macOS is the Clang compiler, provided as part of the Xcode development tool. You will need to install Xcode from the Apple App Store. It is a free download, but you will need to have or create an Apple ID.
You can also use Qt and Qt Creator on macOS to develop for iOS (i.e. for iPhone, iPod Touch, and iPad devices), or for Android (or both). These use different downloads of Qt and have more prerequisites and won't be covered here.
Installation Steps
Download the Qt installer from http://download.qt.io. For Qt 5.7.1 you can navigate to official_releases / qt 5.7 / 5.7.1 and then download qt-opensource-mac-x64-clang-5.7.1.dmg. It is a reasonably large (1.2 GB) download.
Once it has downloaded, open the dmg file:
From the Qt Installer, follow the wizard screens in the same fashion as on Windows and Linux. Here were the screens I stepped through: Sims 4 free download mac. Once done, you can launch Qt Creator:
You should check that it correctly set up at an auto-detected kit with the compiler, Qt version, and debugger:
This is a good time to create some sample projects to test your installation. Use the New Project Wizard and confirm that you can create the project, build it and run the application. Testing both widget and QML-based projects is recommended. You are now ready for Qt software development on macOS. If you want to update, add or remove any components, you can run the maintenance tool, which will be found under the Qt install directory as MaintenanceTool. Summary
It's easy to get Qt up and running using the installer. I'm not a regular macOS user so on the occasions where I need to build a Qt application for the Mac, I appreciate that I can use the familiar Qt Creator IDE to do most of my work rather than having to learn another IDE.
ReferencesDownload Qt Creator
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |