To make Apache NetBeans cooperate with CMake projects on your Mac it requires just a few extra steps. CMake used to have a tool to do this for you, but now navigating in CMake to Tools->How to Install for Command Line Use shows you this:
I’m going to chose the symlink option, open up the Terminal App and type:
Now that CMake is properly installed to the command line tool chain, open up NetBeans and go to the Preferences and click on the C/C++ tab. Enter the newly created symlink path /usr/local/bin/cmake for the CMake Command and click apply:
Now navigate to File->New Project. Choose C/C++ Project with Existing Sources and click next:
Browse to find your project root directory containing the CMakeLists.txt file, and everything should be good to go, just click finish!
NetBeans should run CMake to generate the Makefile, and should you edit your CMakeLists.txt file, just right-click the CMakeLists.txt file in the project tree and select Generate Makefile to generate a fresh one. All done and good to go! Happy coding!
If you’re weird like me, you don’t really like using Xcode to program C/C++ on your Mac. If you haven’t already done so, setup the command line tools since macOS does not come with them pre-installed. NetBeans is typically used for Java programming, and is written in Java, therefore you need the Java Development Kit (JDK) installed to run it. Recently, Oracle has introduced a new versioning scheme and licensing which at first glance can seem very confusing and overwhelming. To sum it up, unless you are a large corporation or development studio that requires paid commercial support, just download OpenJDK. Any OpenJDK 8+ (including the official Oracle OpenJDK) will work, but the easiest and most painless route is downloading AdoptOpenJDK which installs binaries exactly where they need to go. Personally, I chose the package containing OpenJDK 13 with HotSpot, but any combination works just fine for our purposes.
Anyway, once you have the command line tools, OpenJDK, and finally NetBeans installed, run the Apache NetBeans 11.2 application. Navigate to Tools->Plugins and you will notice there is no longer a C/C++ plugin under the Available Plugins tab in the new Apache version!
Click on the Settings tab and check the box next to NetBeans 8.2 Plugin Portal to activate the old plugins:
Then go to the Updates tab, click on Check for Updates and then press Update:
You will notice the number of Available Plugins has increased! Go ahead and install the C/C++ plugin!
Restart the IDE after the installation is complete and start coding in good old fashioned C/C++ using Apache NetBeans!
If you would like this nice IntelliJ IDEA and Eclipse IDE style dark theme to go along with your Catalina Dark Mode you can download the Darcula LAF plugin. To install go back to Tools->Plugins, click on the Downloaded tab and press Add Plugins. Find your downloaded Darcula plugin and install!
NetBeans is currently my go-to IDE for C/C++ and PHP projects, since I have been using it for many many years and have had zero problems! Next week I begin Java classes for school… I will try out Eclipse and IntelliJ IDEA to see how they compare for Java programming and report back. If you don’t know the differences I will sum it up: NetBeans is the official Java IDE which was recently taken over by Apache (previously owned/developed by Sun – the creators of Java,) Eclipse is the most commonly used Java IDE, and IntelliJ IDEA has both paid and free versions which was used as the basis for Android Studio. Alternatively, for C/C++ projects I enjoy coding the old fashioned way with Sublime Text for my text editor and CMake for cross platform makefile generation. For using CMake with NetBeans see this article.
Unfortunately, macOS does not come with development tools pre-installed like on Linux, BSD, and other *nix systems. Luckily, it’s simple and easy to do. Open up the Terminal application (Applications/Utilities/Terminal.app) and type:
xcode-select --install
This installs all of the standard command line tools you should be used to, since it’s no longer an option to do so inside of the Xcode IDE. Speaking of which, you no longer need an Apple Developer account to install Xcode. Simply open up the App Store application, search for, and install Xcode: