Private customization -- mac configuration articles

Why is it private customization? Because mac starts from the beginning, most of the software and environments need to constantly update the configuration by themselves. It can be seen that we may update the previous environment configuration in the subsequent environment configuration, as we will talk about in the next section of this section. The configuration of the original vim will be reconfigured after macvim is installed later, the current configuration can never be fixed, and the subsequent configuration may subvert the previous configuration to obtain a greater sublimation of functions, that's it Before constantly subverting, we can use it better for ourselves and achieve personal customization. Therefore, this chapter is just a guide, and it is not entirely necessary to do this routine. There can be more personal customization in it to be more suitable for you.

1. A preliminary study on mac environment variables

First briefly understand the directory structure of the macOS system, the article reference

For a detailed introduction to mac environment variables, refer to the article: Portal

�� Draw the key points

View environment variables

Order:

[root@localhost u-boot-sh4]#echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Note:
The format of PATH is:
PATH=$PATH::::——: , separated by colons.

Add PATH environment variable

[root@localhost u-boot-sh4]#export PATH=/opt/STM/STLinux-2.3/devkit/sh4/bin:$PATH

Priority of environment variable files

/etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc

Description:
/etc/profile : This file sets the environment information for each user of the system. When the user logs in for the first time, the file is executed.
And collects the shell settings from the configuration files in the /etc/profile.d directory.
/etc/bashrc: For each This file is executed by the user running the bash shell. When the bash shell is opened, the file is read.
~/.bash_profile: Each user can use this file to enter shell information specific to their use. When the user logs in, the
file is executed only once !By default, it sets some environment variables and executes the user's .bashrc file.
~/.bashrc: This file contains bash information specific to your bash shell,
which .
~/.bash_logout: Execute this file every time you exit the system (exit the bash shell).

In addition, /etc/profilethe variables set in (global) can act on any user, while ~/.bashrcthe variables set in etc (local) can only inherit /etc/profilethe variables in, they are "parent-child" relationship.

~/.bash_profileEnter bash in interactive and login mode. Enter bash
~/.bashrcvin interactive non-login mode.
Usually, the two settings are roughly the same, so usually the former will call the latter.

Mac configuration environment variables
  1. /etc/profile (It is recommended not to modify this file) Global (public) configuration, this file will be read when logging in, no matter which user it is.
  2. /etc/bashrc (usually add system-level environment variables to this file) Global (public) configuration, this file will be read when the bash shell is executed, no matter what the method is.
  3. ~/.bash_profile (usually add user-level environment variables in this file) Each user can use this file to enter shell information dedicated to their own use, when the user logs in, this file is executed only once!
Check the shell type used by MacOS

Order:

echo $SHELL

Instructions:
1. If the output is: csh or tcsh, then you are using C Shell.
2. If the output is: bash, sh, zsh, then you may be using a variant of Bourne Shell. The C Shell was the default before Mac OS X 10.2. The default since Mac OS X 10.3 is the Bourne Shell.
3. Then you can add the environment variable you want to add to .profile or .bash_profile under your home directory, if it exists, you can add it, if not generate one.

The default shell of mac is bash, switch the command:

chsh -s /bin/bash #Switch the default terminal bash
chsh -s /bin/zsh #Switch the terminal shell to zsh

⚠️Note
When zsh is installed on the mac machine, the environment variables in the .bash_profile file will not work.
Solution:
(1) cd ~
(2) open .zshrc
(3) Add a reference to .bash_profile at the end of the .zshrc file: source ~/.bash_profile

Reason: The default shell of linux and macOS is bash, and the loaded environment variable configuration file is ~/.bash_profile. When using the zsh shell, the default loaded environment variable configuration file is ~/.zshrc, so .bash_profilethe environment variables in the file cannot work. Just add the .bash_profilefile to the .zshrcfile.

2. Mac prerequisite software installation and configuration

homebrew install

Why install homebrew first? Because many installation software later use homebrew to install, so it is better to install homebrew first.
Very simple, reference article:
Official website
article

Terminal artifact – iterm2 installation configuration

These include brew installing iterm2, configuring solarized, configuring oh my zsh, and configuring some fonts, plugins, and more.
For details, please refer to the article: Portal

Command Line Tool – Oh My Zsh

When iterm2 was installed above, oh my zsh was installed. For more oh my zsh configuration, please pay attention to the following documents:
Official warehouse
article

��Delineate key points
lib Provide a script library for core functions
toolsProvide shortcut tools for installation, upgrade and other functions The
pluginslocation of the built-in plugins The location of the
templatesbuilt templates The location of the
themesbuilt-in theme files
customPersonalized configuration directory, self-installed Plugins and themes can be placed here

Terminal vim color matching

Above, when installing iterm2, we configured the solarized theme, then, in the terminal or iterm2, the color scheme of vim, we also use the solarized color scheme, which is consistent and beautiful.
Reference article:
solarized official website
solarized official warehouse
vim uses solarized color matching 1
vim uses solarized color matching 2

⚠️Note
Warning: vim uses solarized color matching, and a configuration file .vimrcis required. When the complete configuration scheme of macvim is installed later .vim_runtime, the configuration file will be overwritten, resulting in failure. How to solve it, please refer to the editor IDE-vim Section 5 mac of vim.

macVim editor

Please move to the fifth section of my other article editor IDE-vimmac of vim , which has a detailed introduction, so I won't repeat it.

Efficiency Artifact – alfred

Installation and use reference: article

python3 installation

The mac system comes with python2.7, now install the python3 version.
Reference: Article

⚠️Note The
article mentioned that in order to avoid the fight between the system python and the python installed in brew, we need to modify the environment variables, we have not modified here, we should install the python3 version for us, it is suitable for python version independent, we use python -v, What I read is the original python of the system. When I use python3 -vit, what I read is the python3 installed by brew, which does not affect each other, so it will not be changed. Of course, this is my own opinion, if you want to know more, please google it yourself.

git install

Because xcode was installed before, git was automatically installed, but the version was not the latest, and the following article describes using brew to install or update the git version.
Reference: Article

installation of tomcat, maven, etc.

The construction of the web environment uses homebrew to install, which is relatively simple and will not be described in detail. If you learn homebrew by yourself, it is very convenient to install and manage software.

Customization continues to update…

3. Operation skills

View the application installation path command:

which git

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325984214&siteId=291194637