Technical Documentation: sb2nov/mac-setup
ℹ️ Provenance: Multi-Tier Ingestion · CodeWiki Reference
Overview (`README.md`)
[macOS Setup Guide](https://sourabhbajaj.com/mac-setup)
This guide covers the basics of setting up a development environment on a new
Mac. Whether you are an experienced programmer or not, this guide is intended
for everyone to use as a reference for setting up your environment or
installing languages/libraries.
Some environments we will set up are Node
(JavaScript), Python,
C++ and Ruby.
Even if you don't program in all of them, they are useful to have as many
command-line tools rely on them. We'll also show you some useful daily use
applications. As you read and follow these steps, feel free to post any
feedback or comments you may have.
Contributing to the guide
All contributions to the guide are welcome. Please help add support for other
libraries and languages. To make a contribution please use our contribution
template.
We're looking for more contributors to maintain and extend the
documentation.
This guide is MIT
licensed and has been
generated using Docusaurus. Feel free to contribute or
create new issues on GitHub.
Intro (`docs/intro.md`)
slug: / title: macOS Setup Guide id: intro
This guide covers the basics of setting up a development environment on a new
Mac. Whether you are an experienced programmer or not, this guide is intended
for everyone to use as a reference for setting up your environment or
installing languages/libraries.
Some environments we will set up are Node
(JavaScript), Python,
C++ and Ruby.
Even if you don't program in all of them, they are useful to have as many
command-line tools rely on them. We'll also show you some useful daily use
applications. As you read and follow these steps, feel free to post any
feedback or comments you may have.
Contributing to the guide
All contributions to the guide are welcome. Please help add support for other
libraries and languages. To make a contribution please use our contribution
template.
We're looking for more contributors to maintain and extend the
documentation.
This guide is MIT
licensed and has been
generated using Docusaurus. Feel free to contribute or
create new issues on GitHub.
Apps Index (`docs/apps/index.md`)
title: Other Apps
Here is a list of apps that are generally good to use and can come in handy in day to day tasks. The apps are separated into 4 broad categories Developer Tools, Productivity Tools, Office Apps and Other.
Development Tools
- Brave Browser: A privacy-focused browser built on Chromium with built-in ad blocking and full Chrome DevTools.
- Google Chrome: Chrome is a developer friendly browser with powerful development tools built in to it.
- Warp: A modern terminal built on Rust with AI-powered command suggestions and collaborative features.
- Cursor: An AI-powered code editor built on VS Code.
- Zed: A high-performance code editor built in Rust with real-time collaboration.
- GitHub Desktop: A GUI for Git that simplifies your development workflow.
- Valentina Studio: Valentina Studio is a GUI to create, administer and query MySQL, Postgres and SQLite databases.
AI Tools
- Claude: Anthropic's AI assistant desktop app.
- Claude Code: An agentic coding tool from Anthropic that lives in your terminal.
Diff and Merge Tools
FileMerge: A free tool which is already installed on your machine. It might not be the most elegant tool, but it's definitely a solid one that does the job of comparing & merging text.
Beyond Compare: Not only can you compare text with this tool but it also supports diffing Word and PDF contents. In the Pro Version it also supports merging.
Araxis Merge: One of the few diff tools that works with more than just text and image files, this one lets you also compare office documents (like MS Word, Excel, PowerPoint, or ODF). A single license is valid for both Windows and Mac.
DeltaWalker: Just like Araxis, this app also lets you compare office files. However, it goes one step further by letting you compare file archives like ZIP, JAR, and TAR files. It also has great performance for comparing folders.
Free alternatives
Both of these tools can't compare in terms of features and user interface with their commercial competitors - but make for a valid alternative on Mac, Windows and Linux.
Productivity
- 1Password: Cross platform password management tool.
- Raycast: An extendable launcher and productivity tool. A modern alternative to Spotlight and Alfred.
- Amphetamine: Stops the machine from going into sleep mode.
- AppCleaner: Uninstall apps cleanly.
- Dropbox: File syncing to the cloud. It syncs files across all devices (laptop, mobile, tablet), and serves as a backup as well!
- Google Drive: File syncing to the cloud too! Google Docs is a popular tool to collaborate with others.
- Rectangle: Don't waste time resizing and moving your windows. Rectangle makes this very easy and is open source.
- Shottr: A small, fast, and feature-rich screenshot tool for Mac.
- Pocket: Save For Later. Put articles, videos or pretty much anything into Pocket.
- Timing: Keep track of the time you spend with your Mac.
- Transmission: A fast, easy and free BitTorrent client.
- Unarchiver: Compress/Uncompress app. Supported file formats include Zip, Tar-GZip, Tar-BZip2, RAR, 7-zip, LhA, StuffIt and many other old and obscure formats.
Communication
- Slack: Team messaging and collaboration.
- WhatsApp: Desktop client for WhatsApp messaging.
- Spotify: Music streaming.
Office Apps
- Keynote: Create presentations on Mac, this is supposed to be an alternate to PowerPoint.
- Microsoft Office: Microsoft Office for Mac. Includes Microsoft Word, Excel, PowerPoint and Outlook.
- Numbers: Create spreadsheets on Mac, this is supposed to be an alternate to Excel.
- Pages: Create text files on Mac, this is supposed to be an alternate to Word.
Other
- Skim: Skim is a PDF reader and note-taker for macOS.
- SuperDuper: Take backups of your disk and use the backup disk to restore the machine in case of failure.
- TimeOut: Scheduled work breaks to prevent stress injuries.
- VLC: VLC Media Player. Enough said.
Docker Index (`docs/docker/index.md`)
title: Docker
Docker is a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.
With Docker, developers can build any app in any language using any toolchain. "Dockerized" apps are completely portable and can run anywhere - colleagues' macOS and Windows laptops, QA servers running Ubuntu in the cloud, and production data center VMs running Red Hat.
Installation
The recommended way to use Docker on macOS is via Docker Desktop.
Using Homebrew
brew install --cask dockerManual Download
Alternatively, download Docker Desktop from the official website.
Verify Installation
After installing and launching Docker Desktop, verify the installation:
docker --version
docker run hello-worldYou can find more about Docker in the documentation.
Git Index (`docs/git/index.md`)
title: Git
What's a developer without Git? To install, run:
brew install gitWhen done, to test that it installed properly you can run:
git --versionAnd which git should output /opt/homebrew/bin/git (Apple Silicon) or /usr/local/bin/git (Intel).
Git LFS
Git Large File Storage replaces large files with text pointers inside Git while storing the file contents on a remote server.
brew install git-lfs
git lfs installGitHub CLI
The GitHub CLI (gh) brings GitHub to your terminal. You can create PRs, review code, manage issues, and more without leaving the command line.
brew install ghAuthenticate with your GitHub account:
gh auth loginNext, we'll define your Git user (should be the same name and email you use for GitHub):
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"They will get added to your .gitconfig file.
To push code to your GitHub repositories, we will use the recommended HTTPS method. There are also instructions for using SSH. To prevent git from asking for your username and password every time you push a commit you can cache your credentials by running the following command, as described in the instructions.
git config --global credential.helper osxkeychainUsing HTTPS for GitHub (recommended)
These instructions are from the official documentation.
Clone repositories using HTTPS
After creating a new repo on GitHub, clone it using:
git clone https://github.com/<username>/<repo-name>.git- if you had initialized with a README.
If you did not, follow the instructions in the section below.
Set up a new or existing repo with HTTPS for GitHub
If you are setting up a new repo, add at least one file and commit first. Then, configure the remote and push to GitHub by running:
git remote add origin https://github.com/<username>/<repo-name>.git
git push -u origin mainSSH Config for GitHub
These instructions are for those who wish to use SSH and not HTTPS, and are from the official documentation.
Check for existing SSH keys
First check for existing SSH keys on your computer by running:
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they existCheck the directory listing to see if you have files named either id_ed25519.pub or id_rsa.pub. If you don't have either of those files then read on, otherwise skip the next section.
Generate a new SSH key
If you don't have an SSH key you need to generate one. To do that you need to run the commands below, and make sure to substitute the placeholder with your email. The default settings are preferred, so when you're asked to enter a file in which to save the key, just press Enter to continue.
ssh-keygen -t ed25519 -C "[email protected]"
# Creates a new ssh key, using the provided email as a labelAdd your SSH key to the ssh-agent
Run the following commands to add your SSH key to the ssh-agent.
eval "$(ssh-agent -s)"Modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519Then add your SSH key to the ssh-agent:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519Adding a new SSH key to your GitHub account
The last step is to let GitHub know about your SSH key so GitHub can recognize you. Run this command to copy your key to your clipboard:
pbcopy < ~/.ssh/id_ed25519.pubThen go to GitHub and input your new SSH key. Paste your key in the "Key" text-box and pick a name that represents the computer you're currently using.
We are now ready to use SSH with GitHub!
Clone repositories using SSH
After creating a new repo on GitHub, clone it using
git clone [email protected]:<username>/<repo-name>.git- if you had initialized with a README.
If you did not, follow the instructions in the section below.
Set up a new or existing repo with SSH for GitHub
If you are setting up a new repo, add at least one file and commit first. Then, configure the remote and push to GitHub by running:
git remote add origin [email protected]:<username>/<repo-name>.git
git push -u origin mainHomebrew Index (`docs/homebrew/index.md`)
title: Homebrew
Homebrew calls itself The missing package manager for
macOS and is an essential tool for any developer.
Installation
Before you can run Homebrew you need to have the Command Line Tools for
Xcode installed. It include compilers and other tools that will allow you
to build things from source. You can install it from the terminal
by running the following:
xcode-select --installTo install Homebrew run the following in a terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"hit Enter, and follow the steps on the screen.
Setting up your `PATH`
On Apple Silicon Macs (M1/M2/M3/M4), Homebrew installs to /opt/homebrew. The
installer will print instructions to add Homebrew to your PATH. Typically you
need to add this to your ~/.zprofile (or ~/.bash_profile if using Bash):
eval "$(/opt/homebrew/bin/brew shellenv)"On Intel Macs, Homebrew installs to /usr/local and is generally already on
your PATH.
Then, to be able to use brew you need to start a new terminal session. After that
you should make sure everything is working by running:
brew doctorIf everything is good, you should see no warnings, and a message that you are
"ready to brew!".
Iterm Index (`docs/iterm/index.md`)
title: iTerm2
iTerm2 is an open source replacement for Apple's Terminal. It's highly customizable and comes with a lot of useful features.
Installation
Use Homebrew to download and install:
brew install --cask iterm2Customization
Colors and Font Settings
Here are some suggested settings you can change or set, they are all optional.
- Set hot-key to open and close the terminal to
command + option + i - Go to profiles -> Default -> Terminal -> Check silence bell to disable the terminal session from making any sound
- Download one of iTerm2 color schemes and then set these to your default profile colors
- Change the cursor text and cursor color to yellow make it more visible
- Change the font to 14pt Source Code Pro Lite. Source Code Pro can be downloaded using Homebrew
brew install --cask font-source-code-pro - If you're using BASH instead of ZSH you can add
export CLICOLOR=1line to your~/.bash_profilefile for nice coloring of listings
MacOS shortcuts ⌘←, ⌘→ and ⌥←, ⌥→
You might be familiar with shortcuts to skip a word (⌥) or go to start/end of the line (⌘). iTerm is not set up to work with these shortcuts by default but here's how you set them up:
Open up iTerm2 preferences (⌘ + ,) -> Profiles -> Keys -> Click on + icon (add new Keyboard shortcut).
| shortcut | action | Esc+ |
|---|---|---|
| ⌘← | Send Escape Sequence | OH |
| ⌘→ | Send Escape Sequence | OF |
| ⌥← | Send Escape Sequence | b |
| ⌥→ | Send Escape Sequence | f |
Touch ID sudo workaround
If you have enabled sudo authentication with Touch ID you will also need to set Preferences -> Advanced -> Allow sessions to survive logging out and back in to No in iTerm2 preferences.
Java Index (`docs/java/index.md`)
title: Java
Using Java requires you to install a JDK ("Java Development Kit") or JRE ("Java Runtime Environment").
We'll use a JDK since it can do everything a JRE can, plus more.
Choosing a JDK
There are two major JDKs: OpenJDK and the Oracle JDK.
OpenJDK and Oracle JDK provide the same functionality, and are even built from the same code base.
They differ only in their packaging and licensing.
OpenJDK is free for use in all situations.
Oracle JDK requires a paid-for commercial license when used in a production setting.
Most personal users will probably want to use OpenJDK, since it's easier to acquire and install
and that's what we'll be covering here.
Installation
First you should check if Java is already installed
java -versionIf you see a non-empty output like below then Java is already installed on your machine and you are good to go
openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment Homebrew (build 21.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)If you don't see the output like above then you need to install Java on your system
Installing OpenJDK
Installing OpenJDK using Homebrew
brew install openjdkIf you're curious, you can list all the available JDK versions via:
brew search jdkThere will be a lot of options here! If you are not a serious Java developer, don't worry about them, and just use the default openjdk.
Once you've done that, check if Java is correctly installed by running the java -version command again.
Downloading and installing OpenJDK manually
Open a web browser and go to Adoptium. Select the latest LTS version and download the installer for macOS.
Once you've done that, check if Java is correctly installed by opening a new Terminal session and running the java -version command again.
Python Index (`docs/python/index.md`)
title: Python
macOS ships with Python already installed.
But you don't want to mess with the system Python (some system tools rely on
it, etc.), so we'll install our own version(s). There are two ways to install
Python, (1) Homebrew and (2) Pyenv. If you plan to use multiple versions of
Python then you should use pyenv.
Installation
Homebrew method
brew install pythonInstalling Python also installs pip
(and its dependency Setuptools),
which is the package manager for Python. Let's upgrade them both:
pip3 install --upgrade setuptools
pip3 install --upgrade pipPyenv method
pyenv is a Python version manager that can
manage and install different versions of Python. Works very much like rbenv
for Ruby. First, we must install pyenv using Homebrew:
brew install pyenvTo upgrade pyenv in the future, use upgrade instead of install. After
installing, add pyenv init to your shell to enable shims and autocompletion.
Add the following to your ~/.zshrc (or ~/.bash_profile if using Bash):
eval "$(pyenv init -)"Restart your shell to make sure the path changes take effect.
exec $SHELLYou can now begin using pyenv. To list the all available versions of Python,
including Anaconda, Jython, PyPy and Stackless, use:
pyenv install --listThen install the desired versions:
pyenv install 3.12
pyenv install 3.11Use the global command to set global version(s) of Python to be used in all
shells:
pyenv global 3.12
pyenv rehashAll installed Python versions can be
located in ~/.pyenv/versions. Alternatively, you can run:
$ pyenv versions
system (set by /Users/your_account/.pyenv/version)
* 3.12
3.11This shows an asterisk * next to the currently active version.
Application-specific Python version
The local command will set local application-specific Python version(s) by
writing the version name to a .python-version file in the current directory.
This version overrides the global version. For example:
$ cd path/to/directory
$ pyenv local 3.11
$ pyenv versions
system
3.12
* 3.11 (set by /Users/your_account/path/to/directory/.python-version)Ruby Index (`docs/ruby/index.md`)
title: Ruby
macOS comes with Ruby installed, but as we don't want to be messing with operating system core files we're going to use the tools rbenv and ruby-build to manage and install our Ruby versions for our development environment.
Installation
brew install rbenv ruby-build rbenv-default-gems rbenv-gemset
echo 'eval "$(rbenv init -)"' >> ~/Projects/config/env.sh
source ~/.zshrc # Apply changesThe packages we just installed allow us to install different versions of Ruby and specify which version to use on a per project basis and globally. This is very useful to keep a consistent development environment if you need to work in a particular Ruby version.
Switching versions
We can install version 3.1.1 and use it as our global version by running:
rbenv install 3.1.1
rbenv global 3.1.1On M1 Macs to install older version of Ruby eg. <2.7.3, <2.6.7 you first need to run:
export optflags="-Wno-error=implicit-function-declaration"Managing gems in application
Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.
gem install bundler
echo 'bundler' >> "$(brew --prefix rbenv)/default-gems"When starting a Ruby project, you can have sandboxed collections of gems. This lets you have multiple collections of gems installed in different sandboxes, and specify (on a per-application basis) which sets of gems should be used. To have gems install into a sub-folder in your project directory for easy later removal / editing / testing, you can use a project gemset.
echo '.gems' > <my_project_path>/.rbenv-gemsetsYour gems will then get installed in project/.gems.
Configuration
If you use Google for finding your Gem documentation then you might want to consider saving a bit of time when installing gems by not including the documentation.
echo 'gem: --no-document' >> ~/.gemrcSublime Text Index (`docs/sublime-text/index.md`)
title: Sublime Text
Sublime Text is a widely used editor that describes it self as a sophisticated text editor for code, markup and prose.
Installation
Install using Homebrew:
brew install --cask sublime-textOr download the .dmg file and drag-and-drop it to the Applications folder.
Use CLI to open file
Let's create a shortcut through which we can launch Sublime Text from the command-line
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublNow you can open a file with subl myfile.py or start a new project in the current directory with subl ..
Pricing
Sublime Text is not free but it has an unlimited evaluation period that comes with notification pop-ups asking you to buy it, if you wish to remove the pop-ups you can purchase the tool here.
Bash Completion (`docs/bash-completion.md`)
title: Bash Completion
Bash completion is a bash function that allows you to auto complete commands or
arguments by typing partially commands or arguments, then pressing the [Tab]
key. This will help you when writing the bash command in terminal.
Install Latest Bash
macOS ships with an outdated version of Bash (3.2). You can install the latest
version using Homebrew:
brew install bashTo use the Homebrew-installed Bash as your default shell, add it to the list of
allowed shells and set it:
sudo sh -c 'echo "$(brew --prefix)/bin/bash" >> /etc/shells'
chsh -s "$(brew --prefix)/bin/bash"Installation
Use bash-completion@2, which is designed for Bash 4.2+ (the version installed
by Homebrew):
brew install bash-completion@2For it to work, add this to your ~/.bash_profile:
[[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]] && . "$(brew --prefix)/etc/profile.d/bash_completion.sh"Restart your bash session:
source ~/.bash_profileUsage
Once you've done this, you can use bash completion by pressing the tab key
twice after a command. For example:
$ git [tab] [tab]
add blame cherry-pick config format-patch gui merge push repack rm stage whatchanged
am branch citool describe fsck help mergetool range-diff replace send-email stash worktree
apply bundle clean diff gc init mv rebase request-pull shortlog status
archive checkout clone difftool gitk instaweb notes reflog reset show submodule
bisect cherry commit fetch grep log pull remote revert show-branch tagMore
You can list additional completion packages available by typing:
brew search completionAnd you can install them using brew install commands, for example:
brew install docker-completionContributors (`docs/contributors.md`)
title: Contributors
Thank you to everyone who has contributed to creating this awesome guide! 🎉
This project exists thanks to all the people who contribute:
103 contributors • 653 total contributions
Want to contribute? Check out our contribution guidelines and help make this guide even better!
Cpp (`docs/cpp.md`)
title: C++
Make sure you have installed Xcode Command Line Tools. Verify the compiler is available:
$ c++ --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posixTo be able to compile files from your terminal you can add the following alias in your shell configuration file (e.g. ~/.zshrc).
alias cppcompile='c++ -std=c++17 -stdlib=libc++'Then you can run all cpp file directly using cppcompile main.cpp and it will use C++17.
Emacs (`docs/emacs.md`)
title: Emacs
Emacs is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as the extensible, customizable, self-documenting, real-time display editor.
Development of the first Emacs began in the mid-1970s, and work on its direct descendant, GNU Emacs, continues actively.
Installation
There are many Emacs clients on macOS. The recommended version on macOS is Emacs Mac Port, but others are good as well.
[Emacs Mac port](https://bitbucket.org/mituharu/emacs-mac/overview) (Recommended)
Many useful features are built with Emacs Mac Port, e.g. environment variables, full screen, visual enhancements and so on.
Link the Homebrew tap first.
brew tap railwaycat/emacsmacport- Method 1: Install with
brew cask.
brew install --cask emacs-mac There are three available versions, emacs-mac, emacs-mac-official-icon, emacs-mac-spacemacs-icon.
- Method 2: Install using
brew.
brew install emacs-mac [options]Click here to see available options:
--with-dbus, Build with d-bus support--with-modules, Build with dynamic modules support--with-xml2, Build with libxml2 support--with-ctags, Don't remove the ctags executable that emacs provides--with-no-title-bars, Build with a patch for no title bars on frames (--HEAD is not supported)--with-natural-title-bar, Build with a patch for title bar color inferred by your theme (--HEAD is not supported). More info is provided here--with-official-icon, Using official Emacs icon--with-modern-icon, Using a modern style Emacs icon by @tpanum--with-spacemacs-icon, Using the spacemacs Emacs icon by Nasser Alshammari--with-icon-for-documents, Using official icon for documents which default open with Emacs
[Emacs plus](https://github.com/d12frosted/homebrew-emacs-plus#emacs-plus)
Start off by tapping the official emacs-plus cask.
brew tap d12frosted/emacs-plusInstall the latest version of Emacs Plus:
brew install emacs-plus [options]You can also install specific versions (e.g. emacs-plus@29, emacs-plus@30).
Click here to see available options:
--with-24bit-color: Experimental: build with 24 bit color support--with-ctags: Don't remove the ctags executable that Emacs provides--with-dbus: Build with dbus support--with-mailutils: Build with mailutils support--with-natural-title-bar: Experimental: use a title bar colour inferred by your theme--with-no-title-bars: Experimental: build with a patch for no title bars on frames (--HEAD has this built-in via undecorated flag)--with-x11: Experimental: build with x11 support--without-cocoa: Build a non-Cocoa version of Emacs--without-gnutls: Build without gnutls support--without-imagemagick@6: Build without imagemagick@6 support--without-librsvg: Build without librsvg support--without-libxml2: Build without libxml2 support--without-modules: Build without dynamic modules support--without-multicolor-fonts: Build without a patch that enables multicolor font support--without-spacemacs-icon: Build without Spacemacs icon by Nasser Alshammari--HEAD: Install HEAD version
Note: 1) You might want to install exec-path-from-shell if you are using Emacs plus. It takes care of your environment variables.
2) To have the title bar match your theme background color, consider using instead:brew install emacs-plus --HEAD --with-natural-title-bars
Spacemacs
Spacemacs is a new way to experience Emacs -- a sophisticated and polished set-up focused on ergonomics, mnemonics and consistency.
Spacemacs can be used naturally by both Emacs and Vim users -- you can even mix the two editing styles. Switching easily between input styles makes Spacemacs a great tool for pair-programming.
Installation
If you have an existing Emacs configuration, back it up first:
shcd ~ mv .emacs.d .emacs.d.bak mv .emacs .emacs.bakDon't forget to backup and remove
~/.emacsfile otherwise Spacemacs
WILL NOT load since that file prevents Emacs from loading the proper
initialization file.Clone the repository:
shgit clone https://github.com/syl20bnr/spacemacs ~/.emacs.dmasteris the stable branch and it is immutable, DO NOT make any
modification to it or you will break the update mechanism. If you want to
fork Spacemacs safely use thedevelopbranch where you handle the update
manually.(Optional) Install the Source Code Pro font.
If you are running in terminal you'll also need to change font settings of
your terminal.Launch Emacs. Spacemacs will automatically install the packages it requires.
If you get an error regarding package downloads then you may try to disable
the HTTPS protocol by starting Emacs withshemacs --insecureOr you can set the
dotspacemacs-elpa-httpstonilin your dotfile to
remove the need to start Emacs with--insecureargument. You may wish to
clear out your.emacs.d/elpadirectory before doing this, so that any
corrupted packages you may have downloaded will be re-installed.Restart Emacs to complete the installation.
Purcell's Emacs configuration
This is Purcell's emacs configuration tree, continually used and tweaked since 2000, and it may be a good starting point for other Emacs users, especially those who are web developers. These days it's somewhat geared towards macOS, but it is known to also work on Linux and Windows.
Installation
To install, clone this repository to ~/.emacs.d, i.e. ensure that the init.el contained in this repository ends up at ~/.emacs.d/init.el:
git clone https://github.com/purcell/emacs.d.git ~/.emacs.dUpon starting up Emacs for the first time, further third-party packages will be automatically downloaded and installed. If you encounter any errors at that stage, try restarting Emacs, and possibly running M-x package-refresh-contents before doing so.
Doom Emacs
Doom Emacs is a configuration framework for GNU Emacs. It can be considered a hacker's starter kit.
Installation
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom installVisit the documentation for a more detailed guide on installing and customizing Doom.
Go (`docs/go.md`)
title: Go
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Installation
You can follow the official instructions on how to install Go, or you can use Homebrew instead:
brew install goWhen installed, run go version to see the installed version of Go.
Add GOPATH/bin directory to your PATH environment variable so you can run Go programs anywhere. Add this to your ~/.zshrc (or ~/.bash_profile):
export PATH=$PATH:$(go env GOPATH)/binWrite your first program
Modern Go uses modules for dependency management. Create a new project:
mkdir hello && cd hello
go mod init helloCreate a file main.go:
package main
func main() {
println("Hello World!")
}Run the program by running:
$ go run .
Hello World!Import a Go package
With Go modules, you simply import packages in your code and run go mod tidy to download them:
package main
import (
"github.com/gorilla/mux" // Your imported package
"net/http"
)
func yourHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Gorilla!\n"))
}
func main() {
r := mux.NewRouter()
// Routes consist of a path and a handler function.
r.HandleFunc("/", yourHandler)
// Bind to a port and pass our router in
panic(http.ListenAndServe(":8000", r))
}Then run:
go mod tidyThis will automatically download and add the dependency to your go.mod file.
Tooling and learning
Format your code
Go has a built-in tool that automatically formats Go source code.
To format a single file run:
gofmt -w yourcode.goYou can also format an entire package:
go fmt path/to/your/packageLearn more
The interactive tutorial will let you learn more about Go.
Heroku (`docs/heroku.md`)
title: Heroku
Heroku is a Platform-as-a-Service (PaaS) that simplifies deploying your apps online.
Installation
Assuming you have a Heroku account (sign up if you don't), let's install the Heroku Client for the command-line using Homebrew.
brew install heroku/brew/herokuThe formula might not have the latest version of the Heroku Client, which is updated pretty often. Let's update it now:
heroku updateDon't be afraid to run heroku update every now and then to always have the most recent version.
Setup
Login to your Heroku account using your email and password:
heroku loginIf this is a new account, and since you don't already have a public SSH key in your ~/.ssh directory, it will offer to create one for you. It will also upload the key to your Heroku account, which will allow you to deploy apps from this computer.
If it didn't offer create the SSH key for you (i.e. your Heroku account already has SSH keys associated with it), you can do so manually by running:
mkdir ~/.ssh
ssh-keygen -t rsaKeep the default file name and skip the passphrase by just hitting Enter both times. Then, add the key to your Heroku account:
heroku keys:addUsage
Once your keys are in place and you are authorized, you're ready to deploy apps. Heroku has a getting started guide, which has all the information you need (the one linked here is for Python, but there is one for every popular language). Heroku uses Git to push code for deployment, so make sure your app is under Git version control.
A cheat sheet for deployment:
$ cd myapp/
# Create the app on Heroku
$ heroku create myapp
# Deploy it
$ git push heroku master
# Check its status
$ heroku ps
# Check the logs
$ heroku logs -tThe Heroku Dev Center is where you will find more information.
Jetbrains Ides (`docs/jetbrains-ides.md`)
title: JetBrains IDEs
JetBrains is a company creating tools for developers. Their mission is: We make professional software development a more productive and enjoyable experience. In this section a number of IDEs (integrated development environment) as well as a selection of features will be presented.
Selection of Features
Note that these features apply to all IDEs mentioned.
Shared Key Mappings
If you use different programming languages you might also use different IDEs/editors. This forces you to learn different key mappings for each individual IDE/editor. With IDEs from JetBrains you only need to learn one key mapping because it's shared between all of their IDEs. If you customize your key mapping you can even export it from one IDE and import in the other one.
Highly Customizable
Not only can you do lots of customization when it comes to appearance, key mapping and a lot more, you also have plugins. These plugins cover everything from dealing with different file types to using external tools such as Git, Docker, databases, linters and time tracking. JetBrains offer a bunch of their own plugins but you can also develop and publish your own plugins.
Integrated Tools
Their IDEs offer so many tools that you never have to leave it if you don't want to. It supports a number of different VCSs (Git, Subversion, Perforce etc.), a terminal window, database browser, debuggers, SSH sessions and more.
Powerful Refactoring
Rename a method used all over your project with a few clicks, or change a method signature in the same way. With statically typed languages like Java and C the refactoring becomes even more powerful.
Useful Shortcuts
- Search for a file --
CMD + SHIFT + O - Search for a string --
CMD + SHIFT + F - Search everything, press
SHIFTtwo (2) times - Context based action --
ALT + ENTER(this one is very contextual, you have to just try it out having your cursor in different places) - Refactor this --
CTRL + T(place your cursor on what you want to refactor)
Supported Languages
Their IDEs support a number of languages, here's a list covering all of the listed ones sorted alphabetically.
- C, C#, C++
- CSS, Less, Sass, Stylus
- F#
- Go
- Groovy
- Java
- JavaScript, TypeScript
- Kotlin
- Objective-C
- PHP
- Python
- Ruby
- Scala
- SQL
- Swift
- VB.NET
They offer support for more languages using plugins such as Rust, Dart, Haxe, Markdown, Pug/Jade, Slim, Twig and more.
Installation
Go to their website and select what product you'd like to download.
Alternatively, use the Jetbrains Toolbox App to manage product installations.
Pricing
If you're a student or an instructor (teaching staff members) all IDEs from JetBrains are free to use. You can read more on their website. If you're not a student they still offer a few free Community Edition (CE) IDEs. Check out IntelliJ (Java) or PyCharm Edu.
If you as an individual want to have an IntelliJ subscription, for example, it's €14.90/$14.90 every month. Before buying a subscription you should see if you apply for a free/discounted license.
Latex (`docs/latex.md`)
title: LaTeX
LaTeX, which is pronounced «Lah-tech» or «Lay-tech», is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.
Installation
When installing LaTex, two following options are given to users:
- Install MacTeX with builtin editor (TexLive) - (3.2GB)
- Install BasicTeX only (100MB) + your personal LaTeX editor
MacTeX vs BasicTeX
MacTeX includes additional programs such as an editor and a BibTeX reference manager that help users to work with TeX outside of the command line. BasicTeX does not include these GUI programs. The trade-off that comes with using BasicTeX is that you will have to download and install additional packages and programs as the need arises- and BasicTeX is so basic that the need will arise. So, after installing BasicTeX you will be faced with the tasks of installing additional programs and installing missing packages.
MacTex
Download MacTex, or use brew install --cask mactex.
You can read more about MacTex in What is installed (pdf).
Since MacTex installs a LaTex editor (TexMaker) already, installing another LaTeX editor is unnecessary.
BasicTeX
Download BasicTeX, or use brew install --cask basictex. You can read more about BasicTex in BasicTeX (pdf).
You may use tlmgr to install tools/packages that you need.
Note: You may find CLI tool
tlmgrcumbersome to use, in that case install GUI fortlmgr- TeX Live Utility -brew install --cask tex-live-utility.
Now you should pick a LaTeX editor, here are some to choose from:
- TexMaker
- TeXstudio
- TeXworks
- TeXShop
- LyX
- TeXlipse
- Sublime Text 3 - LaTeXTools
- Visual Studio Code - LaTeX-Workshop
Note: You may want to use a PDF reader that watches your PDF files, like Skim (can be installed by
brew install --cask skimand Sync feature can be enabled in Preferences -> Sync).
Mysql (`docs/mysql.md`)
title: MySQL
Installation
We will install MySQL using Homebrew, which will also install some header files needed for MySQL bindings in different programming languages (MySQL-Python for one).
brew install mysqlUsage
To have launchd start MySQL now and restart at login:
brew services start mysqlOr, if you don't want/need a background service you can just use the mysql.server tool:
mysql.server startTo stop it when you are done, run:
mysql.server stopYou can see the different commands available for mysql.server with:
mysql.server --helpTo connect with the command-line client, run:
mysql -uroot(Use exit to quit the MySQL shell)
Note: By default, the MySQL user root has no password. It doesn't really matter for a local development database. If you wish to change it though, you can use mysqladmin -u root password 'new-password'.
Nodejs (`docs/nodejs.md`)
title: Node.js
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Installation
Using Homebrew
brew install nodeUsing Node Version Manager (nvm)
Download and install nvm by running:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bashor via Homebrew:
brew install nvmThen download Node and select your version by running:
source ~/.bashrc # source your bashrc/zshrc to add nvm to PATH
command -v nvm # check the nvm use message
nvm install node # install most recent Node stable version
nvm ls # list installed Node version
nvm use node # use stable as current version
nvm ls-remote # list all the Node versions you can install
nvm alias default node # set the installed stable version as the default NodeSee the documentation for information.
npm usage
To install a package:
npm install <package> # Install locally
npm install <package> # Install globallyTo see what's installed:
npm list [-g]To find outdated packages:
npm outdated [-g]To upgrade all or a particular package:
npm update [-g] [<package>]To uninstall a package:
npm uninstall [-g] <package>yarn
Yarn is another package manager built by Facebook. Yarn stands for Yet Another
Resource Negotiator. It provides similar functionalities as NPM. It is an
alternative to NPM when installing, uninstalling, and managing package
dependencies from the NPM registry or GitHub repositories.
brew install yarnPostgresql (`docs/postgresql.md`)
title: PostgreSQL
PostgreSQL is an open source relational database management system (RDBMS). It is the default database for macOS server.
Installation
brew install postgresqlAfter this, we can test the installation status by checking the version of installed PostgreSQL
postgres -VUsage
Start PostgreSQL server
The recommended way to manage PostgreSQL is via Homebrew services:
brew services start postgresqlThis starts the server now and also sets it to start automatically at login.
Stop PostgreSQL server
brew services stop postgresqlRestart PostgreSQL server
brew services restart postgresqlStart PostgreSQL console
psql postgresGUI tool
Postico is a popular GUI client for PostgreSQL on macOS. Alternatively, TablePlus supports PostgreSQL and many other databases.
References (`docs/references.md`)
title: References
Thank you for all the awesome pages and documentation below which helped set this up.
Contributing
Please feel free to send Pull Requests fixing any mistakes in the guide or adding additional information.
Rust (`docs/rust.md`)
title: Rust
Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
Installation
For installation it's advised to use rustup as it will (among other things)
allow you to switch between versions of Rust without having to download
anything additional.
brew install rustup-initUse rustup to install the Rust compiler (rustc) and the Rust package manager (cargo).
rustup-initTo verify you can run:
rustc --versionThe official documentation on how to install Rust.
Scala (`docs/scala.md`)
title: Scala
Make sure you have Java installed, the instructions are provided here.
Installation
brew install scala sbtVerify the installation:
scala -versionIDE Support
For Scala development, IntelliJ IDEA with the Scala plugin is the most popular choice. Alternatively, VS Code with the Metals extension provides good Scala support.
Security (`docs/security.md`)
title: Security
A development machine should be secured against threats as well as any other machine (or even especially a development machine). Therefore we will setup
- a firewall
- disk encryption
Firewall
If you run potentially vulnerable software you don't want to be accessed from other machines, consider turning the built-in firewall on. This particularly applies if you develop network software.
To turn the built-in firewall on:
- Choose Apple menu () > System Settings, then click Network.
- Click Firewall.
- Turn on Firewall.
- Click Options to configure which apps are allowed incoming connections.
Note: On macOS versions before Ventura, this is under System Preferences > Security & Privacy > Firewall.
Disk Encryption
If you travel a lot and take your notebook with you (including all your source codes), you should enable disk encryption.
The following steps were taken from the official apple support page on this:
- Choose Apple menu () > System Settings, then click Privacy & Security.
- Scroll down to the FileVault section.
- Click Turn On FileVault.
- Follow the instructions. You should create a local and offline possibility to disable encryption, when you are asked how to regain access in case of anything.
Note: On newer Apple Silicon Macs, data encryption is enabled by default.
System Preferences (`docs/system-preferences.md`)
title: System Settings
First Time Setup
The first thing you should do is update your system. To do that go:
Apple menu () > System Settings > General > Software Update.
Also upgrade your OS to the latest version to have a more secure OS. macOS
upgrades are usually free so you might as well keep your machine up to date.
If this is a new computer there are a couple tweaks you could make to the
System Settings. These settings are all optional, consider them
suggestions. Always choose the setting that makes the most sense to you.
Note: On macOS Ventura (13) and later, "System Preferences" has been
renamed to "System Settings" with a redesigned interface.
Users & Groups
- Login Options -> Change fast user switching menu as Icon
- Set up Password, Apple ID, Picture, etc.
Trackpad
- Point & Click
- Enable Tap to click with one finger
- Change Secondary click to Right corner
- Uncheck Three Finger Drag
- Scroll & Zoom
- Uncheck all apart from Zoom in and out
Dock
- Visual Settings
- Change position to Left and make the size of icons Small
- Other settings
- Remove workspace auto-switching by running the following command:
defaults write com.apple.dock workspaces-auto-swoosh -bool NO
killall Dock # Restart the Dock processFinder
- General
- Change New finder window show to open in your Home Directory
- Sidebar
- Add Home and your Code Directory
- Uncheck all Shared boxes
Menubar
- Remove the Display and Bluetooth icons
- Change battery to Show percentage symbols
Spotlight
- Uncheck fonts, images, files etc.
- Uncheck the keyboard shortcuts as we'll be replacing them with
Raycast
Accounts
- Add an iCloud account and sync Calendar, Find my Mac, Contacts etc.
User Defaults
- Enable repeating keys by pressing and holding down keys:
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false(and restart any app
that you need to repeat keys in) - Change the default folder for screenshots
- Open the terminal and create the folder where you would like to store
your screenshots:mkdir -p /path/to/screenshots/ - Then run the following command:
defaults write com.apple.screencapture location /path/to/screenshots/ && killall SystemUIServer
- Open the terminal and create the folder where you would like to store
Security & Privacy
- Set
Require Password ... after sleep or screen saver beginstoimmediately - Enable FileVault to encrypt your hard drive
- Turn on Firewall
Vagrant (`docs/vagrant.md`)
title: Vagrant
Create and configure lightweight, reproducible, and portable development environments. Vagrant is a tool for managing virtual machines via a simple to use command line interface.
Note: For most use cases, Docker is now the preferred way to create
reproducible development environments. Vagrant is still useful when you need
full virtual machines.
Installation
Vagrant uses a virtualization provider. You can use VirtualBox (free) or other providers like VMware or Parallels.
brew install --cask virtualboxNow install Vagrant:
brew install --cask vagrantUsage
Add the Vagrant box you want to use. We'll use Ubuntu 22.04 for the following example.
vagrant box add ubuntu/jammy64You can find more boxes at Vagrant Cloud.
Now create a test directory and cd into the test directory. Then we'll initialize the vagrant machine.
vagrant init ubuntu/jammy64Now lets start the machine using the following command.
vagrant upYou can ssh into the machine now.
vagrant sshHalt the vagrant machine now.
vagrant haltOther useful commands are suspend and destroy.
Vim (`docs/vim.md`)
title: Vim
Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple macOS.
Installation
To install the latest version, use homebrew:
brew install vimThe Ultimate vimrc
The Ultimate vimrc is a collection of vimrc configurations to make easy the usage of vim.
To download the The Ultimate vimrc, you need to install the git client. If you need install it, use home brew:
brew install gitNow, download the vimrc files:
git clone https://github.com/amix/vimrc.git ~/.vim_runtimeTo install the complete version, run:
sh ~/.vim_runtime/install_awesome_vimrc.shTo install the basic version, run:
sh ~/.vim_runtime/install_basic_vimrc.shUpdate
To update the vimrc scripts, run:
cd ~/.vim_runtime && git pull --rebase && cd -Maximum Awesome
Maximum Awesome is a collection of vim configuration and plugins, like a configuration manager for the vim environment.
Installation
To install it, just make a clone of the repository with the git client:
git clone https://github.com/square/maximum-awesome.gitThen install it:
cd maximum-awesome
rakeNOTE: the rake command will install all dependencies needed.
Visual Studio Code (`docs/visual-studio-code.md`)
title: Visual Studio Code
Visual Studio Code is a lightweight code editor with support for many programming languages through extensions
Installation
To install the latest version, use Homebrew:
brew install --cask visual-studio-codemacOS integration
Launch VS Code from the command line.
After that, you can launch VS Code from your terminal:
code .will open VS Code in the current directorycode myfile.txtwill openmyfile.txtin VS Code
Useful Extensions
Python
Python - Python code highlighting
To enable auto-formatting on "Save", i.e.
⌘ + S, configure the following:Change the default formatter to
Blackinstead ofAutopep8. Critical to avoid large diffs. Go to Preferences -> User Settings and update the settingpython.formatter.providertoBlackEnable
Format on SaveSetting: Editor: Format On Save setting on Code -> Preferences -> Settings
JavaScript
- ESLint - Useful to check JavaScript errors and helps in auto-formatting the code
- Prettier - JavaScript code formatter
SQL
Markdown
- Markdown Preview - Read Markdown files in VSCode
GitLens
- GitLens - Supercharge the Git capabilities built into VSCode
Docker
- Docker - Create, manage, and debug images from within VSCode
JSON
- Paste JSON as Code - Infers types from sample JSON data, then outputs strongly typed models and serializers for working with that data in your desired programming language
Live Server
- Live Server - Launches a local development server with live reloading for both static and dynamic
VS Code Icons
- vscode-icons - Adds unique icons to distinguish different file extensions (easier to glance through your directories)
Xcode (`docs/xcode.md`)
title: Xcode
Xcode is an integrated development environment for macOS containing a suite of software development tools developed by Apple for developing software for macOS, iOS, watchOS and tvOS.
Download and install it from the App Store or from Apple's website.
For installing Xcode command line tools run:
xcode-select --installIt'll prompt you to install the command line tools. Follow the instructions and you'll have Xcode and Xcode command line tools both installed.
XQuartz
XQuartz is Apple Inc.'s version of the X server, a component of the X Window System for macOS. It might be useful if you are developing software that uses X11, it's available for download here or via Homebrew:
brew install --cask xquartzApps Octave (`docs/apps/octave.md`)
title: Octave
Octave is a programming language for scientific computing.
Prerequisite
You might need homebrew-cask; if you don't have it, refer to this section.
Installation
Homebrew Octave.app
Octave.app is a project to distribute GNU Octave as a native Mac GUI application, to make it easier to install and use Octave on macOS. Note this is not an official GNU or GNU Octave project.
As this distributes a compiled version of Octave, installation will be much faster.
To install using homebrew-cask run:
brew tap octave-app/octave-app
brew install --cask octave-appHomebrew official
You can also install Octave from the official Homebrew source using the method below.
Install octave from core Homebrew (which is available by default):
brew install octaveNote: If brew complains about not having a formula for Octave, the following command should fix it:
brew tap --repairThe command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
brew update && brew upgradeOctave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours if you are compiling from source.
Note: On Snow Leopard or earlier, Octave requires an X server. You can download one from the XQuartz project.
You might find that you need to add:
setenv ("GNUTERM", "X11")to your octaverc file, normally located at /usr/local/share/octave/site/m/startup.
Apps Settings (`docs/apps/settings.md`)
title: App Settings
These settings are optional. Some of them are highly subjective and should not be considered as the best settings. To each is own.
Airmail
- Add all the accounts into airmail
- Update icons and signatures for all the accounts
- Add alias for all the forwarding addresses
- Change appearance to minimal
CheatSheet
- System Preferences -> Security and Privacy -> Accessibility -> Check
DoubleTwist
- Add the music folder to the library
Spectacle
- Update all major combinations to work with
Shift + Control + 1-9 - Remove the key combinations for the other sizes
- System Preferences -> Security and Privacy -> Accessibility -> Check
Timing
- System Preferences -> Security and Privacy -> Accessibility -> Check
Docker Tips And Tricks (`docs/docker/tips-and-tricks.md`)
title: Tips and Tricks
A collection of useful tips and tricks for Docker.
Delete all containers
NOTE: This will remove ALL your containers.
docker container pruneOR, if you're using an older docker client:
docker rm $(docker ps -a -q)Delete all untagged containers
docker image pruneOR, if you're using an older docker client:
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')See all space Docker take up
docker system dfGet IP address of running container
docker inspect [CONTAINER ID] | grep -wm1 IPAddress | cut -d '"' -f 4Kill all running containers
docker kill $(docker ps -q)Docker Useful Commands (`docs/docker/useful-commands.md`)
title: Useful Commands
Here follows a list of useful Docker commands with useful flags for each
command.
Table of Contents
docker builddocker execdocker imagesdocker inspectdocker logsdocker psdocker rmidocker run- Learn More
[`docker build`](https://docs.docker.com/engine/reference/commandline/build/)
Build an image from a Dockerfile.
docker build [DOCKERFILE PATH]Example
Build an image tagged my-org/my-image where the Dockerfile can be found at/tmp/Dockerfile.
docker build -t my-org:my-image -f /tmp/DockerfileUseful flags
--file -fPath where to find the Dockerfile--force-rmAlways remove intermediate containers--no-cacheDo not use cache when building the image--rmRemove intermediate containers after a successful build (this istrue) by default--tag -tName and optionally a tag in the ‘name:tag’ format
[`docker exec`](https://docs.docker.com/engine/reference/commandline/exec/)
Execute a command inside a running container.
docker exec [CONTAINER ID]Example
docker exec [CONTAINER ID] touch /tmp/exec_worksUseful flags
--detach -dDetached mode: run command in the background-itThis will not make the container you started shut down immediately, as
it will create a pseudo-TTY session (-t) and keep STDIN open (-i)
[`docker images`](https://docs.docker.com/engine/reference/commandline/images/)
List all downloaded/created images.
docker imagesUseful flags
-qOnly show numeric IDs
[`docker inspect`](https://docs.docker.com/engine/reference/commandline/inspect)
Shows all the info of a container.
docker inspect [CONTAINER ID][`docker logs`](https://docs.docker.com/engine/reference/commandline/logs/)
Gets logs from container.
docker logs [CONTAINER ID]Useful flags
--detailsLog extra details--follow -fFollow log output. Do not stop when end of file is reached, but
rather wait for additional data to be appended to the input.--timestamps -tShow timestamps
[`docker ps`](https://docs.docker.com/engine/reference/commandline/ps/)
Shows information about all running containers.
docker psUseful flags
--all -aShow all containers (default shows just running)--filter -fFilter output based on conditions provided,docker ps -f="name="example"--quiet -qOnly display numeric IDs
[`docker rmi`](https://docs.docker.com/engine/reference/commandline/rmi/)
Remove one or more images.
docker rmi [IMAGE ID]Useful flags
--force -fForce removal of the image
[`docker run`](https://docs.docker.com/engine/reference/commandline/run/)
Creates and starts a container in one operation. Could be used to execute a
single command as well as start a long-running container.
Example:
docker run -it ubuntu:latest /bin/bashThis will start a ubuntu container with the entrypoint /bin/bash. Note that
if you do not have the ubuntu image downloaded it will download it before
running it.
Useful flags
-itThis will not make the container you started shut down immediately, as
it will create a pseudo-TTY session (-t) and keep STDIN open (-i)--rmAutomatically remove the container when it exit. Otherwise it will be
stored and visible runningdocker ps -a.--detach -dRun container in background and print container ID--volume -vBind mount a volume. Useful for accessing folders on your local
disk inside your docker container, like configuration files or storage that
should be persisted (database, logs etc.).
Learn More
A list of more useful Docker commands can be found in the
docker-cheat-sheet.
Git Gitignore (`docs/git/gitignore.md`)
title: Git Ignore
Create the file ~/.gitignore as shown below
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db
# Files that might appear on external disks
.Spotlight-V100
.Trashes
# Compiled Python files
*.pyc
# Compiled C++ files
*.out
# Application specific files
venv
node_modules
.sass-cachefollowed by running the command below, in terminal:
git config --global core.excludesfile ~/.gitignoreto not track files that are almost always ignored in all Git repositories.
Or simply download macOS specific .gitignore maintained by GitHub itself and put contents of it to ~/.gitignore.
- You can also use a default gitignore using Curl
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignoreGenerate gitignore
Visit gitignore.io and fill it with your needs.
Homebrew Cask (`docs/homebrew/cask.md`)
title: Cask
Homebrew-Cask extends Homebrew and allows you to
install large binary files via a command-line tool. You can for example install
applications like Brave Browser, Slack, VLC and Rectangle. No more
downloading .dmg files and dragging them to your Applications folder!
Search
To see if an app is available on Cask you can search on the official Cask
website. You can also search in your terminal:
brew search <package>Example Applications
Quick Look plugins
These plugins add support for the corresponding file type to Mac Quick Look
(In Finder, mark a file and press Space to start Quick Look). The plugins
includes features like syntax highlighting, Markdown rendering, preview of
JSON, patch files, CSV, ZIP files and more.
brew install --cask \
qlmarkdown \
betterzip \
webpquicklook \
suspicious-package \
syntax-highlightBrowsers
brew install --cask brave-browserTerminals
brew install --cask warpEditors and IDEs
brew install --cask \
cursor \
zed \
sublime-textAI Tools
brew install --cask \
claude \
claude-codeProductivity
brew install --cask \
raycast \
rectangle \
caffeine \
shottr \
appcleanerDeveloper Tools
brew install --cask \
docker \
github \
conductorCommunication and Media
brew install --cask \
slack \
whatsapp \
spotifyOther Useful Apps
brew install --cask \
1password \
dropbox \
transmission \
vlcHomebrew Usage (`docs/homebrew/usage.md`)
title: Usage
To install a package (or Formula in Homebrew vocabulary) simply type:
brew install <formula>To update Homebrew's directory of formulae, run:
brew updateNote: If that command fails you can manually download the directory of
formulas like this:
cd "$(brew --prefix)/Homebrew/"
git fetch origin
git reset --hard origin/mainTo see if any of your formulas need to be updated:
brew outdatedTo update a formula:
brew upgrade <formula>Homebrew keeps older versions of formulas installed on your system, in case you
want to roll back to an older version. That is rarely necessary, so you can do
some cleanup to get rid of those old versions:
brew cleanupIf you want to see what formulae Homebrew would delete without actually
deleting them, you can run:
brew cleanup --dry-runTo see what you have installed (with their version numbers):
brew list --versionsTo search for formulas you run:
brew search <formula>To get more information about a formula you run:
brew info <formula>To uninstall a formula you can run:
brew uninstall <formula>Recommended Formulas
Here are some useful formulas for enhancing your command-line experience:
Core Utilities
macOS ships with outdated or BSD versions of many command-line tools. These formulas install the latest GNU versions:
brew install \
coreutils \
moreutils \
findutils \
gnu-sed \
grep \
wget \
bash \
base64Note: GNU tools are installed with a
gprefix by default (e.g.gsed,gfind). To use them without the prefix, add theirlibexec/gnubindirectories to yourPATH. For example, Homebrew will display instructions after installing each formula.
Search Tools
brew install the_silver_searcherThe Silver Searcher (ag) is a code searching tool similar to ack, but faster.
Iterm Ack (`docs/iterm/ack.md`)
title: ack
ack is a search tool designed for code. It's built to be a replacement forgrep with higher speed and more options.
Installation
To install the latest version, use homebrew.
brew install ackWhy use `ack` over `grep`
- Faster
- Skips unimportant files by default
- It searches recursively by default
- Customizable
Usage
ack [OPTION]... PATTERN [FILES OR DIRECTORIES]Let's say you want to find all JavaScript files that are using the modulepancakes in your project, with ack it's as easy as
ack --js pancakesOr you may want to find all files that does not contain the word brew
ack -L brewCustomization
You can customize ack to behave the way you want it to, this configuration i
s stored in /.ackrc.
For example, you can add a custom type to use as a flag when searching. The
following configuration will allow you to only search in .md, .mkd and.markdown files using the --markdown flag.
--type-set=markdown=.md,.mkd,.markdownYou can also tell ack to always sort and use colors in the result.
--sort-files
--colorTo see what configuration ack uses you can use the dump flag.
ack --dumpAlternatives to `ack`
The Silver Searcher
The Silver Searcher (ag) is a code searching tool similar to ack, with a focus on speed.
brew install the_silver_searcherUsage is similar to ack:
ag pancakesIterm Fzf (`docs/iterm/fzf.md`)
title: fzf
fzf is a general-purpose command-line
fuzzy finder. On it's own it's not very useful but when combined with other
tools it becomes super powerful.
Installation
Use Homebrew to
install fzf:
brew install fzfIf you want to use shell extensions (better shell integration):
$(brew --prefix)/opt/fzf/installwhich gives you:
- Key bindings (
CTRL-T,CTRL-R, andALT-C) (available for bash, zsh
and fish) - Fuzzy auto-completion (available for bash and zsh)
Example Usages
Add any of these functions to your shell configuration file and apply the
changes to try them out. Or just paste the function in your terminal if you
just want to try it out without saving it.
# fd - cd to selected directory
fd() {
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir"
}# fh - search in your command history and execute selected command
fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}Chrome history from your terminal
Open up your shell config and add following function:
# ch - browse chrome history
ch() {
local cols sep
cols=$(( COLUMNS / 3 ))
sep='{::}'
cp -f ~/Library/Application\ Support/Google/Chrome/Profile\ 1/History /tmp/h
sqlite3 -separator $sep /tmp/h \
"select substr(title, 1, $cols), url
from urls order by last_visit_time desc" |
awk -F $sep '{printf "%-'$cols's \x1b[36m%s\x1b[m\n", $1, $2}' |
fzf --ansi --multi | sed 's#.*\(https*://\)#\1#' | xargs open
}Note: Ensure that path to History file is correct; read more information
on StackOverflow.
Iterm Tree (`docs/iterm/tree.md`)
title: tree
tree is a recursive directory listing command that produces a depth indented listing of files.
Installation
To install the latest version, use homebrew:
brew install treeUsage
Running tree will produce output like this:
$ tree
.
├── Apps
│ ├── Octave.md
│ ├── README.md
│ ├── Settings.md
│ ├── araxis-merge.jpg
│ ├── beyond-compare.png
│ ├── delta-walker.jpg
│ ├── filemerge.png
│ └── kaleidoscope.png
├── CONTRIBUTING.md
├── Cpp
│ └── README.md
├── Docker
│ └── README.md
├── Git
│ ├── README.md
│ └── gitignore.md
└── Go
└── README.md
5 directories, 14 filesTo limit the recursion you can pass an -L flag and specify the maximum depth tree will use when searching.
tree -L 1will output:
.
├── Apps
├── CONTRIBUTING.md
├── Cpp
├── Docker
├── Git
└── Go
5 directories, 1 filesIterm Zsh (`docs/iterm/zsh.md`)
title: Zsh
The Z shell (also known as zsh) is a Unix shell that is built on top of bash
and is the default shell for macOS (since Catalina). It's highly recommended
to install a framework with zsh as it makes dealing with configuration,
plugins and themes a lot nicer.
We've also included an env.sh file where we store our aliases, exports, path
changes etc. We put this in a separate file to not pollute our main
configuration file too much. This file is found in the bottom of this page.
Install zsh using Homebrew:
brew install zshNow you should install a framework, we recommend to use Oh My Zsh
or Prezto. Note that you should
pick one of them, not use both.
The configuration file for zsh is called .zshrc and lives in your home
folder (~/.zshrc).
Oh My Zsh
Oh My Zsh is an open source,
community-driven framework for managing your zsh configuration. It comes
with a bunch of features out of the box and improves your terminal experience.
Install Oh My Zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"The installation script should set zsh to your default shell, but if it
doesn't you can do it manually:
chsh -s $(which zsh)Configuration
The out-of-the-box configuration is usable but you probably want to customise
it to suit your needs. The Official Wiki
contains a lot of useful information if you want to deep dive into what you
can do with Oh My Zsh, but we'll cover the basics here.
To apply the changes you make you need to either start new shell instance
or run:
source ~/.zshrcPlugins
Add plugins to your shell by adding the name of the plugin to the plugin
array in your .zshrc.
plugins=(git colored-man-pages colorize pip python brew macos)You'll find a list of all plugins on the Oh My Zsh Wiki.
Note that adding plugins can cause your shell startup time to increase.
zsh-syntax-highlighting
The Syntax Highlighting plugin adds beautiful colors to the commands you are typing.
Clone the zsh-syntax-highlighting plugin’s repo and copy it to the “Oh My ZSH” plugins directory.
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingzsh-autosuggestions
This plugin auto suggests any of the previous commands. Pretty handy! To select the completion, simply press → key.
Clone the zsh-autosuggestions plugin’s repo and copy it to the “Oh My ZSH” plugins directory.
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestionsEnforce Changes
To apply the changes you make you need to either start new shell instance
or run:
source ~/.zshrcThemes
Changing theme is as simple as changing a string in your configuration file.
The default theme is robbyrussell. Just change that value to change theme,
and don't forget to apply your changes.
ZSH_THEME=pygmalionYou'll find a list of themes with screenshots on the
Oh My Zsh Wiki.
Prezto
Prezto is a configuration framework
for zsh; it enriches the command line interface environment with sane
defaults, aliases, functions, auto completion, and prompt themes.
Install Prezto:
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"Next create your ~/.zshrc by running:
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
doneFor more information on customisation visit the GitHub repository for
Prezto.
Modules
Add modules to Prezto by editing ~/.zpreztorc and adding the modules as
strings to the list:
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'git' \
'syntax-highlighting' \
'history-substring-search' \
'prompt'And don't forget to apply your changes by starting a new shell instance.
Themes
To list all available themes run:
prompt -lThen open up your config file (~/.zpreztorc) and change to the theme you want:
zstyle ':prezto:module:prompt' theme 'minimal'`env.sh`
To include env.sh, open ~/.zshrc and add the following:
source ~/<path to file>/env.shThis file comes with some pre-defined settings, they are all optional.
Please review them before you use them as your configuration. These are just
examples to show you what you can customise in your shell.
#!/bin/zsh
# Add commonly used folders to $PATH
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Specify default editor. Possible values: vim, nano, ed etc.
export EDITOR=vim
# File search functions
function f() { find . -iname "*$1*" ${@:2} }
function r() { grep "$1" ${@:2} -R . }
# Create a folder and move into it in one command
function mkcd() { mkdir -p "$@" && cd "$_"; }
# Example aliases
alias cppcompile='c++ -std=c++11 -stdlib=libc++'
alias g='git'Java Sdkman (`docs/java/sdkman.md`)
title: SDKMAN!
SDKMAN! is a tool for managing parallel versions of multiple software development kits on most Unix-based systems. It provides a convenient command line interface (CLI) and API for installing, switching, removing and listing candidates.
Installation
Open a new terminal and enter:
curl -s "https://get.sdkman.io" | bashFollow the instructions on-screen to complete installation.
Next, open a new terminal or enter:
source "$HOME/.sdkman/bin/sdkman-init.sh"Lastly, run the following code snippet to ensure that installation succeeded:
sdk versionIf all went well, the version should be displayed. Something like:
sdkman 5.0.0+51Usage
Installing an SDK
Latest stable
Install the latest stable version of your SDK of choice (say, Java JDK) by running the following command:
sdk install javaYou will see something like the following output:
Downloading: java 8u111
In progress...
######################################################################## 100.0%
Installing: java 8u111
Done installing!Now you will be prompted if you want this version to be set as default.
Do you want java 8u111 to be set as default? (Y/n):
Answering yes (or hitting enter) will ensure that all subsequent shells opened will have this version of the SDK in use by default.
Setting java 8u111 as default.More commands
- To install a specific version
qualify the version you require:
sdk install scala 2.12.1- To remove a version
sdk uninstall scala 2.11.6Note that removing a local version will not remove the local installation.
- To list candidates
sdk listMore useful commands and usages can be found at SDKMAN Usage.
Python Ipython (`docs/python/ipython.md`)
title: IPython
IPython is an improved Python shell than the one you get from running python in the command-line. It has many cool functions (running Unix commands from the Python shell, easy copy & paste, creating Matplotlib charts in-line etc.). You can find all functions in the documentation.
IPython is a kernel for Jupyter Notebook. If you are confused IPython with Jupyter, refer to the Jupyter documentation
Installation
pip install ipythonIf you want a more fine-grained command you can try the following:
For zsh ->
pip install 'ipython[zmq,qtconsole,notebook,test]'For bash ->
pip install ipython[zmq,qtconsole,notebook,test]Python Numpy (`docs/python/numpy.md`)
title: Numpy
The NumPy, SciPy and Matplotlib scientific libraries for Python are always a little tricky to install from source because they have all these dependencies they need to build correctly.
There are two ways to install these libraries:
- Using
pip
Python provides an inbuilt package management system pip which can be used to install these libraries
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose- Using MacPorts and Python 3.5
sudo port install py35-numpy py35-scipy py35-matplotlib py35-ipython +notebook py35-pandas py35-sympy py35-nosePython Pip (`docs/python/pip.md`)
title: Pip
pip is the package manager for Python. If you installed Python via Homebrew or pyenv, pip is already included.
Verify Installation
pip3 --versionIf it returns a version pip was successfully installed.
Usage
Here are a few pip commands to get you started.
Install a Python package
pip3 install <package>Upgrade a package
pip3 install --upgrade <package>See what's installed
pip3 freezeUninstall a package
pip3 uninstall <package>Python Virtualenv (`docs/python/virtualenv.md`)
title: Virtualenv
Virtualenv is a tool that lets you create an
isolated Python environment for your project. It creates an environment that
has its own installation directories, that doesn’t share dependencies with
other virtualenv environments (and optionally doesn’t access the globally
installed dependencies either). You can even configure what version of Python
you want to use for each individual environment. It's very much recommended to
use virtualenv when dealing with Python applications.
Installation
To install virtualenv run:
pip install virtualenvUsage
If you have a project in a directory called my-project you can set upvirtualenv for that project by running:
cd my-project/
virtualenv venvIf you want your virtualenv to also inherit globally installed packages run:
virtualenv venv --system-site-packagesThese commands create a venv/ directory in your project where all
dependencies are installed. You need to activate it first though (in every
terminal instance where you are working on your project):
source venv/bin/activateYou should see a (venv) appear at the beginning of your terminal prompt
indicating that you are working inside the virtualenv. Now when you install
something like this:
pip install <package>It will get installed in the venv/ folder, and not conflict with other
projects.
To leave the virtual environment run:
deactivateImportant: Remember to add venv to your project's .gitignore file so
you don't include all of that in your source code.
It is preferable to install big packages (like Numpy), or packages you always
use (like IPython) globally. All the rest can be installed in a virtualenv.
Virtualenvwrapper
To make it easier to work on multiple projects that has separate environments
you can install virtualenvwrapper. It's an extension to virtualenv and
makes it easier to create and delete virtual environments without creating
dependency conflicts.
To install virtualenvwrapper run:
pip install virtualenvwrapperDepending on your setup you might need to install it using sudo. Read the
installation
documentation
for more information.
Note: virtualenvwrapper keeps all the virtual environments in~/.virtualenv while virtualenv keeps them in the project directory.
Ruby Rubygems (`docs/ruby/rubygems.md`)
title: RubyGems
RubyGems, the Ruby package manager, should be installed on your machine if you previously have installed Ruby. Verify this by running:
which gemUpdate RubyGems
To update to its latest version with:
gem update --systemInstall gems
To install a gem (Ruby package), run:
gem install <gemname>To install without generating the documentation for each gem (faster):
gem install <gemname> --no-documentList installed gems
gem listTo check if any installed gems are outdated:
gem outdatedUpdate installed gems
To update all gems or a particular gem:
gem update [<gemname>]Remove old gem versions
RubyGems keeps old versions of gems, so feel free to do some cleaning after updating:
gem cleanupSublime Text Packages (`docs/sublime-text/packages.md`)
title: Packages
Install Package Control
The simplest method of installation is through the Sublime Text console. The console is accessed via View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.
This snippet changes each version and older versions will return an error.
To get the current versions code, go to packagecontrol.io
Sublime Text Plugins (`docs/sublime-text/plugins.md`)
title: Plugins
- Alignment: Easy alignment of multiple selections and multi-line selections
- All Autocomplete: Extend Sublime Text 2 auto-completion to find matches in all open files of the current window
- AutoFileName: Plugin that auto-completes filenames
- Bootstrap 3 Snippets: Twitter Bootstrap 3 snippets plugin for Sublime Text 2 and 3
- BracketHighlighter: Bracket and tag highlighter
- Dictionaries: Hunspell UTF8 dictionaries
- DictionaryAutoComplete: Plugin that adds dictionary entries to the completions inside comments
- EncodingHelper: Guess encoding of files, show in status bar, convert to UTF-8 from a variety of encodings
- FileDiffs: Shows diffs between the current file, or selection(s) in the current file, and clipboard, another file, or unsaved changes
- Git: Plugin for some Git integration
- GitGutter: A Sublime Text 2 and 3 plugin to see git diff in gutter
- IndentXML: Plugin for re-indenting XML and JSON files
- Jade: A comprehensive bundle for the Jade template language
- Jedi - Python autocompletion: Jedi is an autocompletion tool for Python
- Jekyll: A plugin for Jekyll static sites
- LaTeXTools: A LaTeX Plugin for Sublime Text 2 and 3
- Python Auto-Complete: Sublime Text 2 plugin which adds additional auto-completion capability to Python scripts
- Python Imports Sorter: Sublime Text 2 plugin to organize your imports easily
- PythonTraceback: Easy navigation in your python tracebacks
- SideBarEnhancements: Enhancements to sidebar. Files and folders.
- SublimeCodeIntel: Full-featured code intelligence and smart auto-complete engine
- SublimeLinter: Interactive code linting framework for Sublime Text 3
- SublimeLinter-pep8: Linter plugin for python using PEP8
- TrailingSpaces: Highlight trailing spaces and delete them in a flash
Sublime Text Preferences (`docs/sublime-text/preferences.md`)
title: Preferences
This is an example of User Settings for a basic development but please feel free to modify or update as per your choice.
{
"auto_complete_delay": 5,
"auto_complete_selector": "source, text",
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"create_window_at_startup": false,
"folder_exclude_patterns":
[
".svn",
".git",
".DS_Store",
"__pycache__",
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
"*.a",
"*.lib",
"*.so",
"*.dylib",
"*.ncb",
"*.sdf",
"*.suo",
"*.pdb",
"*.idb",
"*.psd"
],
"font_face": "Source Code Pro",
"font_size": 13,
"ignored_packages":
[
"Markdown",
"Vintage"
],
"open_files_in_new_window": false,
"rulers":
[
80
],
"translate_tabs_to_spaces": true,
"word_wrap": true
}Sublime Text Sublime Linter (`docs/sublime-text/sublime-linter.md`)
title: Sublime Linter
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "none",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"pep8": {
"@disable": false,
"args": [],
"disable": "",
"enable": "",
"excludes": [],
"ignore": "",
"max-line-length": null,
"rcfile": "",
"select": ""
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}--- METRICS ---
- Files Extracted: 52
- Estimated Token Budget: ~26720 tokens
- Canonical Reference: https://codewiki.google/github.com/sb2nov/mac-setup