setting up cpp development on mac

Installing Git

Xcode

Apple ships a binary package of Git with Xcode.

Homebrew

Install homebrew if you don't already have it, then:

brew install git

Install Conan

Python (Recommended as python is needed)

pip install conan

Homebrew

brew install conan

Adding a Profile

Once Conan is installed create a profile:

conan profile detect

Install CMake

brew install cmake

Setting up SSH Connection

Generate a new SSH Key

Run the command below with your GitHub email:

ssh-keygen -t ed25519 -C "your_email@example.com"

GitHub

Clone Target Repo

git clone --recurse-submodules -j8 git://github.com/foo/bar.git

Note: -j8 is an optional performance optimization that became available in version 2.8, and fetches up to 8 submodules at a time in parallel — see man git-clone.

Installing and Building Files

On a fresh pull from GitHub, run the following in the root directory:

conan install . --build=missing

Use CMake to build the files with:

cmake --preset conan-release
cmake --build --preset conan-release

Now you can run the build:

./mwe_mac-example

Shoutout to Mich for putting this together


edit this page