Skip to content

MacOS Build Environment

Oliver Gorwits edited this page Mar 28, 2024 · 14 revisions
  1. Install iTerm2 and accept the prompt to install Apple Developer Tools: https://iterm2.com/downloads.html

    Navigate to Settings > Advanced and then change the option Scroll wheel sends arrow keys when in alternate screen mode to Yes.

    Navigate to Settings > Profile > Terminal and tick Unlimited Scrollback

  2. Install Homebrew: https://brew.sh/

    eval "$(/opt/homebrew/bin/brew shellenv)"
  3. Install Perl and GNU sed and OpenSSL: brew install perl gnu-sed openssl

  4. Install PostgreSQL: https://postgresapp.com/

  5. Enable snmp locally if you wish: https://help.domotz.com/tips-tricks/how-to-enable-snmp-on-linux-machines/

  6. Disable AirPlay Receiver if you wish to use default port 5000: https://stackoverflow.com/questions/69818376/localhost5000-unavailable-in-macos-v12-monterey

  7. Configure your environment:

    cat >> ~/.zshrc
    export POSTGRES_HOME="/Applications/Postgres.app/Contents/Versions/latest"
    # gnu-sed and psql
    PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$POSTGRES_HOME/bin:$PATH"
    # send cpanm installed perl modules here instead of brew Cellar
    eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
    export PERL_CPANM_OPT='--notest --curl --quiet'
    export CFLAGS="-I$(brew --prefix)/include $(perl -MAlien::SNMP -E 'say Alien::SNMP->cflags')"
    export LDFLAGS="-L$(brew --prefix)/lib $(perl -MAlien::SNMP -E 'say Alien::SNMP->libs')"
    PATH="$(perl -MAlien::SNMP -E 'say Alien::SNMP->bin_dir'):$PATH"
    alias g='git'
    alias gs='git status'
    alias ll='ls -lhG'
  8. Get the above config in place:

    source ~/.zshrc
  9. Set up cpanminus and local::lib:

    curl -L https://cpanmin.us | PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" perl - App::cpanminus local::lib
  10. A ~/.gitconfig looking something like:

    [core]
       autocrlf = input
       whitespace = cr-at-eol
       commentChar = @
    [push]
       default = current
       followTags = true
    [diff]
       noprefix = true
    [user]
       name = Boaty McBoatFace
       email = [email protected]
  11. Get a decent editor config:

    cd
    curl -O https://gorwits.me.uk/data/files/vimrc
    mv vimrc .vimrc
  12. Repurpose the § key to be ` and ± to be ~

    mkdir -p ~/Library/KeyBindings
    cat > ~/Library/KeyBindings/DefaultKeyBinding.dict
    {
       /* this will make all § (i.e. section sign: §) turn into ` */
       "\UA7" = ("insertText:", "`");
       /* this will make all ± (i.e. plus/minus: ±) turn into ~ */
       "\UB1" = ("insertText:", "~");
    }
  13. Or repurpose the § key to be Escape

    mkdir -p ~/Library/KeyBindings
    cat > ~/Library/LaunchAgents/give.me.esc.key.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>give.me.esc.key</string>
        <key>ProgramArguments</key>
        <array>
            <string>hidutil</string>
            <string>property</string>
            <string>--set</string>
            <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}]}</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
    </dict>
    </plist>

That’s it.

For Netdisco and SNMP::Info developers, you should cpanm Alien::SNMP Mozilla::CA CPAN::Uploader IO::Tty.

See also:

Clone this wiki locally