Please wait...

小波Note

四川 · 成都市小雨7 ℃
English

My Mac Configurations

This article is optional language
阿坝藏族羌族自治州Thu, January 30, 2025 at 12 PM5.42k266Estimated reading time 10 min
QR code
FavoriteCtrl + D

Installed software

Intellj IDEAWebStormData GripVisual Studio CodeApifoxAnotherRedisDesktopManagerDockerTermiusSnipasteOBS StudioChrome

Git

xcode has git, so you just need to download xcode, xcode is used in many places, so it is generally downloaded, it is recommended to download from the official website, not from the app store, because the download speed of the app store is too slow.

The latest version on the official website is 16.2, which is 2.7GB, and after decompression, it is about 10GB, so downloading and installing both take time.

xcode official download address

Terminal

~/.zshrc
        #terminal
export CLICOLOR=1
autoload -U colors && colors
export PROMPT="%{$fg_bold[green]%}it-fb %{$fg_bold[yellow]%}%1~ %# %{$reset_color%}"

    

tips: Run source ~/.zshrc after saving to take effect

CLICOLOR=1 means enabling colors

autoload -U colors && colors means loading colors

%{$fg_bold[green]%} means setting the text color to green and bold

%{$fg_bold[yellow]%} means setting the text color to yellow and bold

%1~ means the first character of the current directory, ~ means home directory

%# means the command prompt, % means a regular user, # means root user

%{$reset_color%} means resetting the text color

Effect

https://img.softmk.com/img/2025/01/30/71beda34-4644-41f0-9549-db261c4a588c.png

FNM

fnm website

~/.zshrc
        #fnm
eval "$(fnm env --use-on-cd --shell bash)"

    

SDKMAN

sdkman website

~/.zshrc
        #sdkman
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"

    

Compression

Using Apple's built-in compression tool has some drawbacks, such as not being able to set a password and excluding unnecessary files like .git and .DS_Store.

Therefore, you can use a bash script with the zip command.

The process is roughly as follows: Find the Automator app 1

Then select Quick Action 2

Pay attention to the highlighted red box 3

Exclude all hidden files

bash
        #!/bin/bash
cd $(dirname "$1")
zip -r $(basename "$1").zip ./$(basename "$1") -x ".*" "*/.*" "*/__MACOSX/*"

    

Exclude .git and .github folders

When packaging projects, you usually don't need to include .git and .github folders. You can use the following script.

bash
        #!/bin/bash
cd $(dirname "$1")
zip -r $(basename "$1").zip ./$(basename "$1") -x "*/.git/*" "*/.github/*" "*/node_modules/*" "*/.DS_Store" "*/__MACOSX/*"

    

Encryption

Using Apple's scripting language AppleScript, you can pop up a dialog to get the password, and then use the zip command to compress the files.

bash
        #!/bin/bash

# Use AppleScript to pop up a dialog to get the password
PASSWORD=$(osascript -e 'Tell application "System Events" to display dialog "Enter password for ZIP file:" default answer "" with hidden answer buttons {"Cancel", "OK"} default button "OK"' -e 'text returned of result')

# Check if the password is empty
if [ -z "$PASSWORD" ]; then
  exit 0
fi

cd $(dirname "$1")

zip -r -P "$PASSWORD" $(basename "$1").zip ./$(basename "$1") -x "*/.DS_Store" "*/__MACOSX/*"

    

The first time you use it, an authorization dialog will pop up. Just click "Allow". 4

Effect

5

Astral