Mac command not found

记录一些 Mac上遇到一些问题:

电脑更新后,不知道怎么环境出现了一些问题, 想安装serve,自己打包后,启动服务,但是npm i serve -g ,就是报 command not found

source ~/.bash_profile 保存环境变量后没有生效

原因:zsh和bash有别, zsh模式不执行上述脚本,bash模式才执行

zsh、bash 模式互相切换

切换bash chsh -s /bin/bash

切换zsh chsh -s /bin/zsh

1、切换到bash

2、vim ~/.bash_profile

:wq

3、source ~/.bash_profile

1、进入主目录cd ~

2、显示隐藏文件,找到. bash_profile文件夹 ls -a(如果没有可以只直接创建)

3、编辑文件 **sudo vim .**bash_profile

4、按i进入编辑模式,加入source ~/.bash_profile后,esc

5、:wq保存退出

相关推荐
Jackson@ML10 分钟前
2026最新版Anaconda Navigator for Mac安装使用指南
python·macos·anaconda
聪明人12 小时前
macOS安装Redis
数据库·redis·macos
九天轩辕18 小时前
跨平台符号表生成规则详解:Windows/Linux/macOS/OHOS
linux·windows·macos
阿捏利21 小时前
详解Mach-O(三十三)Mach-O __mod_term_func节
macos·ios·c/c++·mach-o
零千叶21 小时前
养龙虾,本地部署OpenClaw
人工智能·macos·openclaw
Mr_sun.1 天前
Mac中通过PD安装Rockly、Centos版本的linux并设置静态ip与安装Docker
linux·macos·centos
2501_915106321 天前
如何在 Mac 上面代理抓包和数据流分析
android·macos·ios·小程序·uni-app·iphone·webview
blackorbird1 天前
Coruna 间谍软件活动持续扩散,苹果破例为旧版iOS设备推送双版本安全补丁
macos·ios·objective-c·cocoa
房开民1 天前
使用cuda核函数加速 yolov5后处理
yolo·macos·cocoa
段帅星1 天前
mac下sublime text优化
macos·编辑器·sublime text