macos中安装和设置ninja

1、在安装ninja的过程中需要先安装re2c(github地址:https://github.com/skvadrik/re2c):

bash 复制代码
git clone https://github.com/skvadrik/re2c.git

(也可直接下载最新的release压缩包,并解压。下载地址:https://github.com/skvadrik/re2c/releases)

打开终端,cd到re2c目录下执行:

bash 复制代码
./autogen.sh

这一步若报错:autoreconf: command not found,说明未安装automake,执行第2步安装automark;若执行成功直接执行第3步

2、通过homebrew安装automake,若未安装homebrew,先执行以下命令安装homebrew:

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

已安装homebrew,安装automake:

bash 复制代码
brew install automake

安装libtool

bash 复制代码
brew install libtool

以上步骤完成之后,接着执行第1步

3、接着执行:

bash 复制代码
$ ./configure 
$ make -j4 && make install

4、以上3步之后,rec2就安装完成了,接下来安装ninja,执行以下命令:

bash 复制代码
git clone https://github.com/ninja-build/ninja.git && cd ninja

Python安装:

bash 复制代码
./configure.py --bootstrap

CMake安装:

bash 复制代码
cmake -Bbuild-cmake -H.

cmake --build build-cmake

最后,将可执行文件拷贝到/usr/bin/(或/usr/local/bin)目录下:

bash 复制代码
cp ninja /usr/bin/   #使用sudo不能复制到/usr/bin/目录下,可使用下面的方法
或
ln -s /Users/mac/code/ninja/ninja /usr/local/bin/ninja

注:在/.zshrc或/.bash_profile文件中,设置alias=/Users/mac/code/ninja/ninja,没起作用。

相关推荐
传奇开心果编程7 分钟前
【SwiftUI入门练中学】第7课 动画与手势:让界面更灵动
学习·macos·ui·ios·swiftui·swift
the3clipse7 小时前
MacOS、Linux 与 Windows 视频编解码对比:AV1、HEVC、ProRes 与硬件加速优劣势
linux·windows·macos·hevc·av1·视频解码·硬件解码
传奇开心果编程18 小时前
【SwiftUI娓娓道来】第3课:让界面活起来——交互与动画指南
学习·macos·ui·ios·swiftui·swift
朋友圈自动点赞工具1 天前
Gmail 委托邮箱在手机上关不掉
macos·智能手机·cocoa·硬件评测
小黄人软件1 天前
AndroidStudio老项目 macOS运行BlueTooth蓝牙串口助手(Android+Studio源码).rar
android·macos
她说..1 天前
IntelliJ IDEA 快捷键速查表(Mac 版)
java·macos·intellij-idea
for_ever_love__1 天前
iOS: CABasicAnimation动画
macos·ios·cocoa
ITKEY_1 天前
Mac mini彻底禁止自动睡眠
macos
k4m7v2pz2 天前
用中文编程语言写游戏:玄铁语言生命游戏的 macOS 适配实录
游戏·macos·玄铁·生命游戏·中文编程语言·玄铁中文编程
大熊猫侯佩3 天前
macOS27 上可变界面尺寸 iOS App 揭秘
macos·ios·swiftui