3
submitted 1 year ago* (last edited 1 year ago) by glad_cat to c/cpp@programming.dev

Sorry for writing this shitty guide but it's an issue that doesn't seem to be answered on the internet, and I really needed a recent version of clang++ on macOS for a new job. Feel free to make fun of me if there is an easier way to do it.

  1. Install Nix (usually used for reproducible builds but you can use it too for virtual environments): https://nixos.org/download.html#nix-install-macos

  2. Create a file called shell.nix at the root of your project, and put the following code inside:

{ pkgs ? import <nixpkgs> {} }:
  pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages; [ llvmPackages_16.clangUseLLVM ];
}
  1. Run nix-shell

  2. Check that you have the good version with the command clang++ -v

It's not a perfect solution, but it's mostly automated, you'll be able learn various topics of C++20 with this, and the stupid "clang 11" from Apple is not hijacking the latest version anymore.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here
this post was submitted on 14 Jul 2023
3 points (100.0% liked)

C++

1732 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS