[2020 version mac migration] migration to macos 10.15 Catarina Create a work environment from scratch without using an assistant (CUI edition)

I bought a MacBook Pro 2020. It's been about 3 years.

I always want to keep the PC environment clean, but the best time to buy a new PC is. Even if I buy a new PC, I don't always use the migration assistant. Since you can reconfirm the machine environment and take inventory, you can recreate a beautiful environment as a result.

I wrote an article about migration work three years ago. [2017 version] New environment construction for Mac OS Sierra (mainly CUI) -Qiita I will keep a record this time as well.

Setting work

Prepare the foundation for CUI

iTerm2 installation and settings

Where to get: Official website

Installation

The Mac comes with a standard terminal app called Terminal from the beginning, but iTerm2 is very easy to use, so install it. iTerm2 - macOS Terminal Replacement

The goodness of iTerm2 is also introduced below. Mac terminal application is decided by iTerm2 ! ! Recommended settings and basic function summary – Webrandum

Settings (skip if not needed)

I set the color scheme to Japanesque. Since it is not the theme that is included from the beginning, import the downloaded one.

Step 1. Git clone the file containing the theme.

git clone https://github.com/aereal/dotfiles.git

Step 2. Select "colors / Japanesque / Japanesque.itermcolors" from iTerm2 Preferences => Import) Step 3. Select "Japanesque" from the color scheme (Preference => Profiles => Colors => Load Preset => Japanesque) (Japanesque can be selected in step 2.)

The setting method is also described below. Set Japanesque to Colors in iTerm2 -Qiita

Then I set the font to Ricty. A programming font with a reputation for readability. Ricty must be installed separately. It will be installed by executing the following command.

brew tap sanemat/font
brew install ricty
cp -f /usr/local/opt/ricty/share/fonts/Ricty*.ttf ~/Library/Fonts/
fc-cache -vf

The installation method is also described below. Install Ricty using Homebrew -Qiita

After installation, select a font from Preferences. (Preference => Profiles => Text)

XCode installation

Where to get: app store

--Command Line Tools must be installed to install Homebrew (described later). --XCode is required to install Command Line Tools.

is.

Command Line Tools are installed when you install Homebrew, so we'll install XCode here. Start XCode once and click "Agree".

Homebrew installation

Obtained from: Obtained from the command line by referring to the official website

Package Manager for macOS (or Linux) — Homebrew

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

I used to have to install Command Line Tools manually, but now it installs for me.

Install packages to improve work efficiency

We will install packages that improve work efficiency.

brew install neovim
brew install zsh
brew install wget tree fzf jq nkf massren tig fasd rsync

From the beginning, the login shell from Catarina is zsh. However, I installed the Homebrew version of zsh because the stable version was newer.

Prezto installation

Prezto is a zsh framework. Convenient zsh settings are pre-written.

The installation method is officially described. I'm git clone to the given directory to create a symbolic link in my home directory.

sorin-ionescu/prezto: The configuration framework for Zsh

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

Web server construction

It is the construction of the Web server that will be the local development environment.

MySQL installation

Diverted from Qiita

CREATE USER `username`@localhost IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON DB name.* to `username`@localhost;

SQLite installation

I rarely use SQLite in actual projects, but I sometimes use it as a simple tool.

brew install sqlite

PHP 7.4 installation

PHP 7.3 was included from the beginning. Do a brew search to find out which version you can install with Homebrew.

I referred to the following.

/usr/local/opt/[email protected]/bin:

brew search php@7
==> Formulae
[email protected]                    [email protected]                    [email protected]

Since 7.4 is the latest, install it.

brew install [email protected]

Put the path in .zshrc. I originally defined it with PATH = ~, so I added it.


# ~/.zshrc

PATH=/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/sbin:〜:$PATH

Adjust php.ini. I have adjusted the following:

--Set character encoding to UTF-8 * Maybe that is the case from the beginning --Time zone setting --Set to refer to environment variables (\ $ _ENV ['HOME'] can refer to your home directory.)

default_charset = "UTF-8"
date.timezone = Asia/Tokyo
#variables_order = "GPCS"
variables_order = "EGPCS"

Tool installation for PHP

Composer

The PHP package management tool Composer is also installed with Homebrew.

brew install composer

PshSH

Install PHP's REPL environment, PshSH, with Composer.

composer g require psy/psysh:@stable

Apache installation

Apache is installed on the mac from the beginning, but the Homebrew version is easier to use, so install it separately.

brew install httpd

Find out the location of the configuration file.

apachectl -V

In the configuration file, the following are adjusted.

--mod_rewrite enabled --Virtual Host enabled --Loading the php module --Process as php when accessed with extension .php

LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so #Uncomment

# Virtual hosts
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf #Uncomment

#Added below
LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Install npm package (global only)

Install only the npm package for global use.

npm install -g yarn

Commands for convenient use of GUI applications

Open ForkLift 3 as the default file viewer (Open ForkLift 3 instead of Finder)

I am using ForkLift 3 as a file management software. Menus such as "Open in Finder" and "Reveal in Finder" normally open in the Finder, but change the settings so that ForkLift 3 opens.

defaults write -g NSFileViewer -string com.binarynights.ForkLift-3

The meaning of this command is detailed below. Change ForkLift 3 to Mac default filer -Debug Your Life // Debug your life.

Recommended Posts

[2020 version mac migration] migration to macos 10.15 Catarina Create a work environment from scratch without using an assistant (CUI edition)
How to quickly create a morphological analysis environment using Elasticsearch on macOS Sierra
[Note] How to create a Mac development environment
Create a machine learning environment from scratch with Winsows 10
How to create an instance of a particular class from dict using __new__ () in python
Create an environment for "Deep Learning from scratch" with Docker
I came up with a way to create a 3D model from a photo Part 01 Creating an environment
How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda
Create an API that returns data from a model using turicreate
Deploy Django + React from scratch to GKE (3) Create a GCP project
[Mac] Create a Python3 execution environment from the fully initialized state
From PyCUDA environment construction to GPGPU programming on Mac (MacOS 10.12 Sierra)