When the “cask” option is used, the user has access to over 3800 Mac OS X GUI programs that can be installed and updated. With the “mas” option, the user can download and update programs from the Apple App Store. The Homebrew developer’s describe Homebrew very concisely: “Homebrew installs the stuff you need that Apple didn’t.”. Install MySQL on Mac Using DMG; Uninstall MySQL on Mac; MySQL is very straight forward to install on a Mac. If you do not already have the Homebrew package manager for Mac you’ll need to install that first. If you would rather not install Homebrew you can also install MySQL using the DMG file available on the MySQL site. Installing Homebrew.
Contents
- Brewfile
- Shell Script
- Configure the development environment on Mac
Outline
I try to configure new development environment from scratch on Mac. The blog post list below is about how to set the development environment manually before.
In this blog post, I will introduce how to make an automatic configuration of the development environment with Homebrew and Shell script for more easily to configure the development environment on Mac.
Development environment structure
The list below is what I use for developing now.
Let’s see how to make this list to the automatic configuration with Homebrew and Shell script.
Brewfile
You can use Homebrew to download automatically the tools what you want to use.
Brewfile
is the file that defines the tools you want to download automatically via Homebrew. To make Brewfile that includes your current tools on Mac, execute the command below.When I checked Brewfile created by this command, this doesn’t include every tools. So, I made Brewfile that I added the tools what I want to use.
Let’s see more details about how to define the tools like above.
brew
we can use
brew 'node'
if the tools can be download officially via Homebrew. If you don’t know exactly tool name, you can execute the command below to search it.And then, you can see the result like below.
as you see the result, you can see
Formulae
and Casks
list. the tools that are officially supported by Homebrew are in Formula
List. writing them in Brewfile like below, you can download all by one command later.cask
So What is
Casks
? Casks are the tools that you can download via Homebrew but Homebrew doesn’t support them officially. In other words, using Casks via Homebrew, you can download the tools that you downloaded usually from the web.For example, Google’s
Chrome
is not supported by Homebrew officially, but you can download it via Homebrew Casks.execute the command above, you can see the result like below.
In the list,
google-chrome
is Chrome browser what we use usually. We can install it via Homebrew command like below.Writing them in Brewfile with Casks like below, we can download them via Homebrew.
mas
If the tools are in Mac’s
App store
, What do we do? In this case, we can use Homebrew to download them too. To download the tools exist in App store, we should use Homebrew’s mas
to download them.Execute the command below to install
mas
.After installing mas, you can search the tools that you can download from App store via the command below.
When you search
xcode
like above, you can see the result like below.And then, you can download it using the command below.
Write the tools that you can download via mas in Brewfile like below.
Of course, we can’t download them without mas, so write mas installation like below on the top of Brewfile.
we can install all tools in Brewfile via the command below.
This command requires Homebrew installed on Mac. Let’s make Shell script to install Homebrew and configure the tools.
Shell Script
We can easily install the tools by using Brewfile. However, we need Shell script not only to install but also to configure them.
Install Homebrew and Brewfile
First, create
./install.sh
and modify it like below to install Homebrew, and install the tools in Brewfile.And you can execute the command below to execute them.
Security & Privacy
The tools downloaded by Casks are same as the tools downloaded from Web so when you execute them, they are not executed immediately because of
Security
. In this case, usually we click Allow...
button on System Preferences > Security & Privacy
to execute them.In this case, also we can use the command to allow them like below.
And we can open the tools by executing the command below.
write these commands in
./install.sh
like below.the reason that I use the open command is to keep the tools in
Dock
of Mac.Fonts
To use
D2coding
font for source code font in VSCode and Meslo LG M Regular for Powerline
font for zsh and iTerm2, I downloaded and copy them to ./fonts/
folder.To install the pre-downloaded font on the new Mac, execute the copy command below.
Add this command to
./install.sh
file.zsh
Create
./zsh/
folder to save zsh configuration. Create ./zsh/install.sh
file and modify it like below.This command is to install oh my zsh.
And then, copy the current settings file(
~/.zshrc
) to ./zsh/
folder. the content below is my current configuration of oh my zsh.To copy this file, add the command below to
./zsh/install.sh
file.Lastly, add the command below for installing zsh theme to
./zsh/install.sh
file.The completed
./zsh/install.sh
is as below.To execute
./zsh/install.sh
script, modify ./install.sh
file like below.VSCode settings
Create
./vscode/
folder to manage VSCode installation and settings, and create ./vscode/install.sh
file.Add the command below to install and open VSCode.
And then, to install VSCode
Extention
, add the command like below.To install VSCode extension, we need to execute the command like
code --install-extension [extension id]
. You can find extension id
on the right of the extension name in the extension detail page like below.Lastly, copy the current VSCode configuration to
./vscode/
folder. VSCode configuration is on the folder below.To configure copied
settings.json
on new Mac, add the command below to ./vscode/install.sh
file.The completed
./vscode/install.sh
is as below.Add the command below to
./install.sh
to execute ./vscode/install.sh
script.iTerm2
Create
./iterm2/
folder to manage iTerm2 installation and configuration. And open the current iTerm2.To export the current iTerm2 configuration, click
Preferences... > General > Preferences
.Check
Load preferences from a custom folder or URL
like above, and click Browse
button and set ./iterm2/
folder created above.After setting, click
Save Current Settings to Folder
button to export current iTerm2 configuration.After than, you can see
./iterm2/com.googlecode.iterm2.plist
file is created.Now, create
./iterm2/install.sh
file and modify it like below.The commands above are to add
com.googlecode.iterm2.plist
file copy command we’ve created above, and the command that set zsh default shell.Add the command below to
.install.sh
file.jekyll configuration
I use
jekyll
to make the blog. To install jekyll, create ./jekyll/install.sh
file and modify it like below.And add the command below to
./install.sh
to execute the script above.react-native environment
I use
React Native
for the app development. To install React Native, create ./react-native/install.sh
file and modify it like below.- npm install -g react-native-cli: install react-native-cli
- npm config set save-exact=true: this command is the npm nodule version fixed in package.json when they are installed to reduce react-native version problems.
- sudo gem install cocoapods: instlal Cocoapods to use pod in iOS
Open
./install.sh
file and modify it like below.python development environment
Create
./python/install.sh
file and modify it like below to install libraries for development.Add the command below to
./install.sh
to execute it.Xcode
Lastly, create
./xcode/install.sh
to install `Xcode.- mas install 497799835: use Homebrew mas to isntall Xcode.
- sudo xcodebuild -license accept: accept Xcode license via command.
Add the command below to
./isntall.sh
to execute the script.Save the development environment(Github)
Save these development environment settings on
Github
. You can see all my settings above on the link below.Reset Mac and install latest OS
Reboot Mac to reset and install latest OS. When rebooting, press
Command + Option + r
to use Internet recovery. I fyou want to know more details, see the link below.Configure the development environment on Mac
After recovery, open Terminal and execute the command below to check Git version.
Git is not installed yet, so you can see the dialog about it. Install Git via the dialog.
After installing Git, execute Git clone command below to clone the development environment script we’ve made.
After cloning, execute the command below to configure Mac automatically.
When the script is executed, some script is required the administrator privilege, so you should enter the administrator password.
Configure iTerm2 manually
Update Homebrew Mac
Unfortunately, I don’t find to configure iTerm2 font and theme automatically. So, we need to configure iTerm2 font and theme manually like below.
Completed
When I updated new Mac OS Catalina, I needed to configure the development environment from scratch. When I’ve configured the development environment, I’ve set them manually one by one. So, I wrote this blog post for automatical configuration.
Download Homebrew
Now, I can easily configure Mac with Homebrew and Shell script. Now, let’s make your own Brewfile and Shell script for configuring the development environment automatically on your Mac!
Github Sponsor
Mac Homebrew Tutorial
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!