Skip to content

Installing Languages on A Mac

The following section includes a summary of how to install a variety of programming languages and check that they are installed and working, and includes

  • XCode
  • XCode command line tools
  • Homebrew
  • C
  • C++
  • Java
  • Scala
  • Clojure
  • Common Lisp
  • Prolog
  • Node.js & NPM
  • Typescript
  • Ruby
  • Rust
  • Haskell
  • Elixir
  • Kotlin

Install Xcode

This simplest and easier way to get XCode which then gives you Swift, C, C++, Objective-C is to install XCode from the App store.

install Xcode Command Line Tools 

  1. Go to Terminal in /Applications/Utilities/
  2. Input the following command string in Terminal: xcode-select -—install
  3. In the same way that you are downloading new software and apps, a popup update window will appear asking you: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?”
  4. Select confirm by clicking Install.
  5. Wait for the Xcode Command Line Tools package to install. It is around 130 MB and usually installs fairly quickly, although it depends on your connection.
  6. Once everything is installed, the installer goes away, and you should be able to access any of the new commands that you’ve now got access to. Enjoy using your new Unix command line tools! 

Homebrew

Homebrew is the default package manager for OSX, head over to https://brew.sh/ and follow the instructions on the home page

It’s as simple as using the following command

Once installed you can simply test it by checking the version and then running ‘brew update’ and ‘brew upgrade’

C/C++

C & C++ are both included in the standard XCode install and are available on the command line as clang and GCC respectively

Java

Java consists of the compiler ‘javac’ and the virtual machine (JVM ) ‘java’. You can install just the JVM by installing the JRE ( Java Runtine Engine ) but as we are going to develop with Java we need the full SDK.

There is a great description of how to install Java at https://adamtheautomator.com/install-java-on-mac/ which is as simple as

And then to check it installed

Scala (JVM)

Now we have Java we can install a number of other JVM languages, the first of these is Scala. Detailed instructions can be found at

https://www.scala-lang.org/download/ and is basically

And to check it works and installed

Clojure (JVM)

Clojure is a variant of the Lisp family, runs on the JVM and is great for web-based development if you put the effort into learning Lisp ways of doing things. Detailed install instructions can be found at https://ericnormand.me/guide/how-to-install-clojure#mac-leiningen-1. Clojure ideally needs leiningen installed as its build/toolchain, so there are a number of steps to jump through to get it installed and working correctly

First we install leiningen

Next clojure tools themselves

Test Clojure is installed by running the REPL

And run the lein REPL

Common Lisp

Common Lisp has been around for long time but is a great implementation of Lisp. Full details can be found at :https://formulae.brew.sh/formula/clisp

Prolog

See install details at: https://www.swi-prolog.org/build/macos.html

Node.js

Typescript

Ruby

https://mac.install.guide/ruby/13.html

Ruby is already installed on the Mac, but its version 2.x. To upgrade we need to brew install 3.x version and then modify the path

And then add the following to your shell rc file

Here is an example of editing the .zshrc file, sourcing it and then checking new version is in place

Rust

Full details on installing Rust onto your mac can be found on the Rust install home page https://www.rust-lang.org/tools/install, and is as simple as the following command and a shell reboot

Then check its working by checking its version

Kotlin

https://kotlinlang.org/docs/command-line.html#homebrew

And then check its working…

Haskell

Like most of the languages in this page, the easiest way to install is using Homebrew. Full details can be found at https://www.haskell.org/ghcup/

And then check its version and its working

Carbon

Carbon is an experimental language from Google aimed at replacing C++. Its still in early dev stage but is functional and working, but takes a bit of effort to get installed. I added a blog page with more details here, basically its following these commands