macOS需要安装的软件

更新时间 🔔🕙 2023年7月2日

macOS需要在【/Users/userName/.zprofile】中添加下面的path:

alias ll='ls -alF'

export LANG=zh_CN.UTF-8

#java
export JAVA_HOME='/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home'

#maven
export MAVEN_HOME='/Users/userName/workfolder/tools/maven/apache-maven-3.9.0'
export PATH=$PATH:$MAVEN_HOME/bin:/usr/local/bin

#android

#cmake
#export PATH="/Applications/CMake.app/Contents/bin":"$PATH"

#nodejs
export PATH="/Users/userName/workfolder/tools/node-v18.14.2-darwin-arm64/bin":"$PATH"

# android
export ANDROID_SDK_ROOT='/Users/userName/Library/Android/sdk'
export ANDROID_NDK_ROOT='/Users/userName/Library/Android/sdk/ndk'
export PATH="$ANDROID_SDK_ROOT":"$PATH"
export PATH="$ANDROID_NDK_ROOT/25.1.8937393":"$PATH"
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/build-tools/33.0.0

# flutter
export PATH="/Users/userName/workfolder/tools/flutter/bin":"$PATH"

# Homebrew
export PATH="/opt/homebrew/bin":"$PATH"
eval "$(/opt/homebrew/bin/brew shellenv)"
# ruby
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
# export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"

安装Homebrew

# 访问该网址【https://brew.sh/index_zh-cn】,执行下面的命令进行安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 若是无法直接下载,可以将该【install.sh】下载之后,进行安装

安装cocoapods开发macOS程序

一般都会提示下面的错误,实际上是系统自带的ruby版本太低了,可以通过Homebrew来安装最新版本。:
ERROR: While executing gem … (Errno::EROFS)
Read-only file system @ rb_sysopen – /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem。

# 使用 Homebrew 更新 Ruby 版本
brew install ruby

#查看当前使用的源地址。
gem sources
# gem 删除默认源命令:
# 注:默认的url地址后必须有”/”,否则删不掉。 gem sources -r url地址
gem sources --remove https://rubygems.org/
# gem 添加国内源
gem sources -a https://gems.ruby-china.com/
//(官网给的原来的淘宝镜像已失效)或者
gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/
# 确认是否添加成功
gem sources -l
# 更新源的缓存
gem sources -u

# 访问该网址【https://guides.cocoapods.org/using/getting-started.html#installation】,执行下面的命令进行安装
sudo gem install cocoapods
转载请备注引用地址:编程记忆 » macOS需要安装的软件