Skip to content

Instantly share code, notes, and snippets.

@NickCrew
Created January 24, 2022 20:16
Show Gist options
  • Save NickCrew/13a97a47f78f7ec4b229f48db1d3a7d8 to your computer and use it in GitHub Desktop.
Save NickCrew/13a97a47f78f7ec4b229f48db1d3a7d8 to your computer and use it in GitHub Desktop.
Install macOS Dev Tools
#!/usr/bin/env zsh
#
# Install dotfile dependencies
#
# {{{ Lib functions
local function dots_show_usage () {
echo "USAGE:"
echo " dots-tool-installer [neovim|devtools|langs|fonts]"
echo ""
}
local function dots_ensure_brew() {
if ! command -v >/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
}
local function dots_install_brew_pkg () {
dots_ensure_brew
brew install "$@"
}
local function dots_install_gnu_utils () {
dots_install_brew_pkg \
gnu-sed \
coreutils \
gnupg \
gawk
}
local function dots_install_build_tools () {
dots_install_brew_pkg \
autoconf \
automake \
byacc \
bzip2 \
gcc \
gnupg \
libevent \
make \
pkg-config
}
# }}}
# {{{ Tool Groups
local function dots_install_fonts () {
dots_ensure_brew
brew tap homebrew/cask-fonts
brew install --cask \
font-sauce-code-pro-nerd-font \
font-fira-code-nerd-font
}
local function dots_install_neovim () {
dots_install_fonts
dots_install_lua_pkgs
dots_install_python_pkgs
dots_install_nodejs_pkgs
dots_install_brew_pkg --HEAD universal-ctags/universal-ctags/universal-ctags
dots_install_brew_pkg --HEAD neovim
dots_install_lang-tools
dots_install_pipx_pkgs
pip install -user pynvim
pip install --user 'python-lsp-server[all]' pylsp-mypy pyls-isort
}
local function dots_install_langs () {
dots_install_brew_pkg \
nodejs \
luarocks
npm install -g \
ansible-language-server \
bash-language-server \
dockerfile-language-server-nodejs
prettier \
pyright \
vim-language-server \
vscode-json-languageserver \
yaml-language-server \
yarn \
luarocks install --server=https://luarocks.org/dev luaformatter
luarocks install fennel
dots_install_brew_pkg \
pyenv \
pyenv-virtualenv \
pyenv-virtualenvwrapper \
pipx
pipx install \
pylint \
ansible \
ansible-lint \
yapf \
autopep8
}
local function dots_install_devtools () {
dots_install_fonts
dots_install_gnu_utils
dots_install_brew_pkg \
autossh \
howdoi \
macvim \
tldr
dots_install_brew_pkg --HEAD universal-ctags/universal-ctags/universal-ctags
dots_install_brew_pkg gh
gh extension install gennaro-tedesco/gh-f
if ! command -v cargo >/dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
source ~/.cargo/env
cargo_pkgs=(zoxide mcfly broot bat exa)
for p in $cargo_pkgs; do
if ! command -v $p >/dev/null; then
cargo install $p
fi
done
[[ ! -f ~/.cargo/bin/rg ]] && cargo install ripgrep
[[ ! -f ~/.cargo/bin/fd ]] && cargo install fd-find
}
# }}}
if [[ -z "$1" ]]; then
dots_show_usage; exit 1;
else
for x in "$@"; do
echo "Installing tools: ${x} ..."
dots_install_${x}
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment