Skip to content

Latest commit

 

History

History
377 lines (333 loc) · 13.6 KB

File metadata and controls

377 lines (333 loc) · 13.6 KB

Tips and Tricks on MacOS

Change the Lock Screen Keyboard Shortcut on your Mac

  • Why? Because the default lock screen keyboard shortcut interferes with important Emacs key-bindings
  • Launch System Preferences and go to the Keyboard pane.
  • Select the ‘Keyboard Shortcuts’ tab.
  • From the list on the left, select ‘Application Shortcuts’.
  • Click on the plus (+) button below to add your new shortcut.
  • In the dialog box we’ll want to leave ‘All Applications’ selected in the first menu. Enter ‘Lock Screen’ as the Menu Title. Please note this has to be exactly the same name you entered when saving the service in Automator. Finally, enter your keyboard shortcut. Let’s go with Option+Shift+Q
  • Click Add and you’re all done!

Turn the wifi on/off from the terminal on your Mac

  • You have to use networksetup for this
    # List all the hardware ports controlled by networksetup
    networksetup -listallhardwareports
    # Turn the wifi on
    networksetup -setairportpower en0 on # or off
          

Check if your Mac machine is overheating

pmset -g thermlog
  

Storing and Using secrets in shell scripts and config files on MacOSX

If you have a local script or .bashrc or some other config script, avoid exporting/setting secret variables directly in these scripts. Instead:
  1. Open Keychain Access.app
  2. Add a new keychain from File > New keychain
    • Using new keychain will allow you to use a different password than login for storing secrets.
    • You can also use the login keychain, if you don’t want to enter password each time
  3. Add a name for the keychain, once you will click on Save button, it will ask to enter the password for the new keychain.
    • Add a decently complex password.
  4. Once added, select the newly created keychain from the left pane of the Keychain Access app.
  5. To add a new password item, select File > New Password Item. Fill in the following details:
    • Keychain item name: This is the keyword to access your keychain item.
    • Account Name: This could be anything, usually used to group 1 or more password items
    • Password: This is the secret you want to store in the Keychain against this item.
  6. Once added, you should test the secret access in terminal with following command:
    security find-generic-password -a TEST_account_name -s TEST_item_name -w
        

To load secrets, you can now create a function in your script as follows:

function load_secrets () {
  export SECRET1=$(security find-generic-password -a TEST_account1 -s TEST_item1 -w)
  export SECRET2=$(security find-generic-password -a TEST_account1 -s TEST_item2 -w)
}

Homebrew Tips and Tricks

Denote file at: Homebrew tips and tricks

To see which installed packages use a certain package

brew uses --installed xz

Programming languages on the Mac

These are experiments that have not graduated to my main setup yet.

Install the Bend programming language

Details at: https://github.com/HigherOrderCO/bend

brew install hvm
hvm --version
brew install bend-lang
bend --version

My personal Operating System setup from scratch for macOS Monterey

Mac: Install my favorite Nerd Fonts

Mac: Install the basics for getting started with anything else

  • Install brew from https://brew.sh
  • Install common packages from brew, as mentioned in the section copied from my Ubuntu guide (pasted below)
  • After completing common package installation, install casks and packages specific to MacOS
    brew install ledger pinentry-mac gnu-sed gnupg gnuplot coreutils dog neofetch pandoc ffmpeg qpdf zig fossil protobuf sccache marksman tailscale
        
    brew install --cask brave-browser discord docker ghostty iterm2 keepassxc maccy macfuse mactex signal transmission tresorit vlc whatsapp zulip
        

Ubuntu: Install the basics for getting started with anything else

  • Common packages (Replace sudo apt with brew for Mac OS)
    sudo apt install tmux mercurial subversion aspell automake texinfo shellcheck tree wget curl trurl git jq direnv
        
  • Linux specific packages
    sudo apt install gnome-tweaks aspell-en gawk default-jre-headless default-jre
        

Mac: Set up file sharing to access private files

Follow the instructions below to set up my private dotfiles.

Ubuntu: Set up file sharing to access private files

  • Setup my file-sharing systems to get access to my common files
  • Symlink my ssh keys and gpg keys from my file-sharing systems to the home dir
  • Make sure that Notes on GnuPG / GPG::How to copy your .gpg folder and set the correct permissions

Mac: Clone my public dotfiles into my source folder

  • Symlink .gitconfig and .gitattributes from my public dotfiles to the home dir.

Mac: Install fish shell

brew install fish

After installing fish, install fisher. Then install the following plugins:

  • fisher install jorgebucaran/fisher
  • fisher install jorgebucaran/nvm.fish
  • fisher install ilancosman/tide@v6

Mac: Install Rust and Rust based CLI tools

The CLI tools mentioned here are great productivity boosters. Check them out by searching for them if you are not sure what they do.

Follow the instructions below to install Rust and Rust based CLI tools.

  • Install Rust using Rustup as described at https://www.rust-lang.org/learn/get-started
  • Install all the tools I use
    cargo install --locked atuin bat difftastic dprint du-dust exa fd-find git-delta hyperfine jless mergiraf procs ripgrep rust-analyzer sd sqlx-cli tagref tealdeer tokei vivid vl-convert websocat zoxide
        

Mac: Install Go and Go based CLI Tools

Mac: Install Jujutsu as my main VCS driver

Note that we need to have completed the Rust step above before we do this.

# To install the *prerelease* version from the main branch
cargo install --git https://github.com/jj-vcs/jj.git \
     --locked --bin jj jj-cli

Mac: Install tmux-tpm from source

Follow the instructions below to install tpm : The tmux plugin manager
  • Symlink .tmux.conf to home dir
  • Clone the tmux-tpm repo
    git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
        
  • Execute C-b I inside tmux once to install all the plugins

Mac: Install everything needed for Clojure development

brew install clojure/tools/clojure borkdude/brew/clj-kondo borkdude/brew/babashka cljstyle borkdude/brew/jet lilactown/brew/eql clojure-lsp/brew/clojure-lsp-native

Install jdk sources

brew install --cask temurin@25
brew install visualvm mvn

Mac: Setup email via notmuch

  • Install notmuch deps manually
    brew install xapian gmime talloc zlib notmuch msmtp isync
        
  • Symlink notmuch/.notmuch-config, .mbsyncrc and .msmtprc from private dotfiles to Home.
  • Symlink notmuch dir in private-dotfiles to <maildir>/.notmuch/hooks

Mac: Install Emacs from jimeh-builds

Mac: Install uv for managing python tools and projects

brew install uv
  • Pygments provides source code highlighting in org-exports
uv tool install shell_sage llm aider-ce

LLM plugins

  1. llm install llm-gemini (for Gemini support)
  2. llm install llm-cerebras (for Cerebras support)

Mac: Install pympress for PDF based presentations

# Doesn't need other packages because they have been previously installed
brew install pympress

Mac: Install yt-dlp for downloading videos from Youtube

brew install yt-dlp

Mac: Install tooling for Javascript

  • We have already installed nvm as part of nvm.fish. Now install node via nvm
nvm install 24
  • We also set the nvm_default_version env var in our fish config, so that the default is v24
  • Finally, install bun at the system level, to use instead of node.
    curl command to install bun.sh
        

Mac: Install elm and tools for elm

  1. Install elm: brew install elm
  2. Install elm tooling:
    1. bun install -g @elm-tooling/elm-language-server
    2. bun install -g elm-format

Mac: Install AWS CLI for accessing ECR

  • brew install awscli
  • awscli configure
  • aws ecr get-login-password --region us-east-1 | podman login --username AWS --password-stdin <ecr-bucket>

Mac: Install tarsnap for setting up backup

  • brew install openssl
  • Follow instructions on the tarsnap site for compilation

Mac: Install pgFormatter

Mac: Install toxiproxy

Project Page: https://github.com/Shopify/toxiproxy

brew tap shopify/shopify
brew install toxiproxy

Mac: Install awscli and rclone

These are important tools for cloud storage management. Both need setup management.

brew install awscli

For AWS CLI config, run aws configure sso to create a profile that you can use for all other AWS commands.

For rclone setup, refer to https://rclone.org/install/ and install the pre-compiled binary using curl

cd && \
    curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip && \
    unzip -a rclone-current-osx-amd64.zip && \
    cd rclone-*-osx-amd64
sudo mkdir -p /usr/local/bin && \
    sudo mv rclone /usr/local/bin/
cd .. && rm -rf rclone-*-osx-amd64 rclone-current-osx-amd64.zip

Run rclone config for setting up the necessary configuration

Mac: Install Iosevka font

brew tap homebrew/cask-fonts && brew install font-iosevka

Mac: Install repomix for loading code into an llm

brew install repomix

Mac: Install espanso for convenient text-expansion outside Emacs

brew tap espanso/espanso;
brew install espanso;

Mac: Install tools for working with data

brew install sqlite-utils datasette

Mac: Install all the agents

Codex and Opencode

brew install codex anomalyco/tap/opencode

Pi Agent

bun install -g @mariozechner/pi-coding-agent

Claude Code

curl -fsSL https://claude.ai/install.sh | bash