Qt Creator Installation - Mac

1. Install and Run Xcode

Though we will use Qt Creator for our programs in CS 106B/X, Mac OS X requires you to install their Xcode system to get a C++ compiler on your machine. To install Xcode, visit https://developer.apple.com/xcode/ and click on the "View in Mac App Store" button. The app store will open, and you should download Xcode. Xcode is a large app, so the download and installation may take some time.

NOTE: Do not install any "Beta" version of Xcode. Beta versions are incomplete software and are often incompatible with Qt Creator. If the newest version is listed as "beta", choose the next lower version of Xcode.

screencast

Once your Xcode has installed, you have to actually run the Xcode application one time in order to to install certain essential components. Open the newly downloaded Xcode application and accept the license agreement.

screencast

2. Download and install Qt Creator

Go to the Qt Creator official download site to download this software. Now scroll down to "MacOS Host", and choose Qt 5.10.0 for macOS (2.5 GB). (The exact version may change over time, but make sure to choose the Mac OS X option.) Your download will begin. The file is very large, so it may take some time. Once you have downloaded the Qt Creator .dmg installer, double-click it to mount it and launch the enclosed installer application, which will install Qt Creator on your computer. You can choose all default options during the installation.

screencast

If you are unable to perform the install because your computer does not have enough disk space, you can un-check some of Qt Creator's optional components to save space. Specifically, if you expand the "Qt 5.10.0" area, you can un-check every box except for "MacOS", as shown in the screenshot below. This will reduce the installation space needed from ~20gb to around 2gb.

screencast

You can now open up Qt Creator using Spotlight (the magnifying glass at the top right of your screen) and typing in "Qt Creator".

3. Try to compile/run a sample project

Let's make sure that all the parts are working together properly by building and running a sample Qt Creator project that uses the Stanford C++ libraries. The Stanford C++ libraries also interact with Java, so if this project runs properly for you, then you will be sure that your Qt Creator and Java JDK are both set up properly. Here's what to do:

  • Download the following project ZIP file to your computer.
  • Un-zip the file's contents to a directory of your choice. You should have a directory named simple-project with several files and folders inside.
  • Open the project. In Qt Creator, choose "File" → "Open File or Project..." or press Ctrl+O (or Command+O on Mac). Navigate to the simple-project folder and open the file simple-project.pro.
  • Qt Creator will ask you a few questions about how to set up the build process for this project. You can just accept the defaults and click "Configure Project".

    screenshot

  • Build it. Now you should be able to Build (Ctrl+B or Command+B) your project in Qt Creator. If it builds properly, your C++ compiler and the Stanford C++ libraries are at least compiling properly. The first time you build a given project, it will take a while (30-60 sec or more) to compile all of the various libraries. You can click the bottom "4 Compile Output" tab if you want to see the progress as it is compiling. (Recommended: In Qt Creator, click Tools → Options → Build & Run, and check the box labeled "Open Compile Output pane when building" to always see this output during compilation.)
  • Run it. Now that it's built, you should be able to Run (Ctrl+R or Command+R) your simple-project. This is the part where Java is needed, so if your Java isn't properly installed, this is probably where it will fail. If it runs properly, you will see a window appear with a smiley face. Congratulations, you're done! Now your machine should work just fine for working on our homework assignments.

    screenshot

If you encounter any problems during your attempt to compile and run the sample project, check out our Qt Creator troubleshooting page. Otherwise, congratulations; you're done!

This document and its content are copyright © Marty Stepp, 2018. All rights reserved. Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form is prohibited without the authors' expressed written permission.