Skip to content

Latest commit

History

66 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

alt text

Mac Setup Script

X64 x64 Build Status

ARM ARM Build Status

Macsetup automates the installation, configuration, and verification of various tools and applications on a macOS system using Homebrew. It leverages a JSON configuration file to define the tools to be installed, their installation commands, verification commands, and additional metadata. This makes it easy to distribute and manage tool installations across multiple systems.

How It Works

  1. Download Configuration: The script first tries to download the config/tools.json file into the ~/.macsetup directory if it is not already present.
  2. Read Configuration Files: If the tools.json file is present, the script uses all *.json files in the ~/.macsetup directory to read the configuration and install the software.
  3. Skip Certain Files: Any file that ends with *.json.d will be skipped and not used for installation.
  4. Install and Verify: For each tool defined in the JSON files, the script runs the installation command and then verifies the installation using the verification command.

Features

  • Installs a list of predefined tools defined in tools.json.
    • Sample json
    {
    "name": "go",
    "install_command": "brew install go",
    "verify_command": "go version"
    }
  • Checks the installation status of each tool using the verify_command.
  • Displays a formatted table with the status of each tool given in tools.json.
  • Prompts the user to install all non-available binaries.
  • New Feature: A JSON file placed in $HOME/.macsetup in the following format can be used to install and verify tools:
    {
    "name": "ghostty",
    "install_command": "brew install ghostty",
    "verify_command": "ghostty --version",
    "notes": "Ghostty is a terminal emulator"
    }
  • Default Tools:The default tools.json file is located in config/tools.json.
  • Sample Configurations: Sample JSON configuration files are available in the samples directory and can be added to the ~/.macsetup directory for custom tool installations.

JSON Object Properties

  • name: The name of the tool.
  • install_command: The command to install the tool.
  • verify_command: The command to verify the installation of the tool.
  • notes: A description of what the tool does.
  • skip: If set to true, skips both installation and verification of the tool.
  • post_installation: An optional command to run after installation and before verification.
  • Distribution Based: The script now supports multiple JSON files, making it more distribution-based. You can use and distribute different JSON files to check and validate installations.

Installation command example

curl -sSL https://raw.githubusercontent.com/bhanurp/macsetup/main/macsetup.sh | bash -s -- --status --install

Usage

Checking Installation Status

To check the installation status of all predefined tools and applications, use the --status flag:

./macsetup.sh --status

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install ZSH and configure shell

brew install zsh
brew install oh-my-zsh
brew install powerlevel10k
echo"source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme">>~/.zshrc
p10k configure

Install Dev Tools

brew install git
brew install --cask iterm2
brew install python
brew install go
brew install openjdk@17
brew install --cask visual-studio-code
brew install --cask slack
brew install --cask postman
brew install jq
brew install --cask docker
brew install --cask rancher
brew install gh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
nvm install stable
brew install httpie
brew install k9s
brew install aws
brew install --cask sdm
brew install jfrog-cli
brew install kubectl
brew install fzf
brew install tree
brew install git-lfs

Browsers

brew install --cask arc
brew install --cask brave-browser

Productivity Tools

brew install rectangle
brew install speedtest-cli
brew install bat
brew install clipper

Configurations

Screenshots in separate folder

  1. Use Shift + Command + 5 to open the screenshot tool.
  2. Click on "Options". Then click "Other Location...".
  3. Select that specific location that you created earlier.

Show hidden files

defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder

Speedup Dock Auto-Hide Delay

defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.5
killall Dock

Make VIM default editor

export EDITOR=vim
export VISUAL=vim

Show Full Path in Finder Title Bar

defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
killall Finder

Git global config

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global core.editor vim

Music

brew install spotify

Default Tools

The following table lists all the binaries that are installed via the default tools.json in

tools.json

:

Tool NameInstallation CommandVerification CommandNotes
zshbrew install zshzsh --versionzsh is a shell similar to bash
omzsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && export ZSH=$HOME/.oh-my-zshoh my zsh is a zsh framework
gitbrew install gitgit --versiongit is a version control system
iterm2brew install --cask iterm2brew list --cask iterm2iTerm2 is a terminal emulator
ghosttybrew install ghosttyghostty --versionGhostty is a terminal emulator
python3brew install pythonpython3 --versionPython is a programming language
gobrew install gogo versionGo is a programming language
javabrew install openjdk@17java -versionJava is a programming language
codebrew install --cask visual-studio-codecode --versionVisual Studio Code is a code editor
slackbrew install --cask slackbrew list --cask slackSlack is a messaging app
postmanbrew install --cask postmanbrew list --cask postmanPostman is an API client
jqbrew install jqjq --versionjq is a terminal JSON processor
dockerbrew install --cask dockerbrew list --cask dockerDocker Desktop is a containerization platform
rancherbrew install --cask rancherbrew list --cask rancherRancher Desktop is an alternative to Docker Desktop
ghbrew install ghgh --versiongh is the GitHub CLI
httpbrew install httpiehttp --versionhttpie is a HTTP client
k9sbrew install k9sk9s versionk9s is a Kubernetes TUI application
awsbrew install awscliaws --versionawscli is the AWS CLI
sdmbrew install --cask sdmbrew list --cask sdmStrongDM is an access management tool
jfrogbrew install jfrog-clijfrog --versionjfrog is a CLI for JFrog products
kubectlbrew install kubectlkubectl version --clientkubectl is the Kubernetes CLI
arcbrew install --cask arcbrew list --cask arcArc is a fancy browser
bravebrew install --cask brave-browserbrew list --cask brave-browserBrave is a privacy-focused browser
rectanglebrew install rectanglebrew list rectangleRectangle is a window manager
speedtestbrew install speedtest-clispeedtest --versionspeedtest-cli is a network speed test tool
batbrew install batbat --versionbat is a cat clone on steroids
clipperbrew install clipperclipper --versionclipper is a clipboard manager
spotifybrew install spotifybrew list spotifySpotify is a music streaming service
fzfbrew install fzffzf --versionfzf is a fuzzy finder generally used with other terminal applications
treebrew install treetreetree is a directory listing program
git-lfsbrew install git-lfsgit-lfs is a Git extension for large files
lsdbrew install lsdlsdlsd is a modern ls command
whatsappbrew install whatsappWhatsApp is a messaging app
ffmpegbrew install ffmpegffmpeg -versionffmpeg is a multimedia framework and tool suite to edit video and audio
mpvbrew install mpvmpv --versionmpv is a terminal media player

GitHub Actions

The repository includes a GitHub Actions workflow to validate the installation of tools. The workflow checks if tools.json exists, installs the necessary tools, and validates their installation.

About

A script for managing software installation on macos using distributable JSON files

Topics

Resources

Security policy

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages