Last active
January 17, 2025 15:26
-
-
Save fguillen/dd5600dd45dbac993578e288e1f9f77a to your computer and use it in GitHub Desktop.
Ruby dev Mac setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Execute: | |
# curl -o /tmp/ruby_dev_mac_setup.rb https://gist.githubusercontent.com/fguillen/dd5600dd45dbac993578e288e1f9f77a/raw/ruby_dev_mac_setup.rb && ruby /tmp/ruby_dev_mac_setup.rb | |
COMMANDS = [ | |
{ | |
description: "Install XCode command line tools", | |
command: "xcode-select --install", | |
already_installed: "xcode-select --print-path" | |
}, | |
{ | |
description: "Install oHMyZhs", | |
command: "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"", | |
already_installed: "test -d ~/.oh-my-zsh" | |
}, | |
{ | |
description: "Install Homebrew", | |
command: "/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"", | |
after_command: "echo >> /Users/$(whoami)/.zprofile && echo 'eval \"$(/opt/homebrew/bin/brew shellenv)\"' >> /Users/$(whoami)/.zprofile && eval \"$(/opt/homebrew/bin/brew shellenv)\"", | |
already_installed: "brew --version" | |
}, | |
{ | |
description: "Install Visual Studio Code", | |
command: "brew install visual-studio-code", | |
already_installed: "brew list --cask visual-studio-code" | |
}, | |
{ | |
description: "Install Docker and Docker Desktop", | |
command: "brew install docker", | |
already_installed: "brew list --cask docker" | |
}, | |
# { | |
# description: "Install Google Chrome", | |
# command: "brew install google-chrome", | |
# already_installed: "brew list --cask google-chrome" | |
# }, | |
{ | |
description: "Install rbenv", | |
command: "brew install rbenv", | |
after_command: "rbenv init && echo 'eval \"$(rbenv init -)\"' >> ~/.zshrc", | |
already_installed: "rbenv --version" | |
}, | |
{ | |
description: "Install Last Ruby version (Rbenv)", | |
command: "rbenv install $(rbenv install -l | grep -v - | tail -1)", | |
already_installed: "rbenv versions | grep $(rbenv install -l | grep -v - | tail -1)" | |
}, | |
{ | |
description: "Install Powerlevel10k (Shell Prompt decoration)", | |
command: "brew install powerlevel10k", | |
after_command: "echo \"source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme\" >>~/.zshrc && exec zsh", | |
already_installed: "brew list powerlevel10k" | |
}, | |
{ | |
description: "Install PostgreSQL", | |
command: "brew install postgresql", | |
already_installed: "brew list postgresql" | |
}, | |
{ | |
description: "Install DBeaver (DB manager)", | |
command: "brew install dbeaver-community", | |
already_installed: "brew list --cask dbeaver-community" | |
}, | |
{ | |
description: "Install Rectangle (Window position manager)", | |
command: "brew install rectangle", | |
already_installed: "brew list --cask rectangle" | |
}, | |
{ | |
description: "Install Maccy (Clipboard manager)", | |
command: "brew install maccy", | |
already_installed: "brew list --cask maccy" | |
}, | |
{ | |
description: "1Password (Password manager)", | |
command: "brew install 1password", | |
already_installed: "brew list --cask 1password" | |
} | |
] | |
def execute_commands(commands) | |
commands.each do |cmd| | |
if system("#{cmd[:already_installed]} > /dev/null 2>&1") | |
puts "β '#{cmd[:description]}' is already done." | |
next | |
end | |
puts "π #{cmd[:description]} (Command: #{cmd[:command]})" | |
print "Do you want to do this? (y/n): " | |
response = gets.chomp.downcase | |
if response == "y" | |
execute_command(cmd[:command]) | |
if cmd[:after_command] | |
execute_command(cmd[:after_command]) | |
end | |
else | |
puts "Skipped!" | |
end | |
end | |
puts "π Done!" | |
end | |
def execute_command(command) | |
puts "Executing: #{command}" | |
unless system(command) | |
raise "Failed to execute: #{command}" | |
end | |
end | |
execute_commands(COMMANDS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added 1Password