MacOS 安装ohpm

一、下载ohpm命令行工具

https://developer.harmonyos.com/cn/develop/deveco-studio#download_cli

image.png

二、安装ohpm

1、下载后修改文件夹名称放到/Users/xxx目录下

image.png

2、打开命令行工具cd到/Users/xx/Huawei/ohpm/bin

运行如下命令:

cd /Users/xx/Huawei/ohpm/bin 
./init

3、打开终端配置环境变量

export OHPM_HOME=/Users/xx/Huawei/ohpm/bin
export PATH=${PATH}:${OHPM_HOME}/bin

4、配置.zshrc及.bash_profile

我看官网文档教程没有介绍这块,导致全局根本引用不到ohpm

zsh:
1. touch ~/.zshrc
2. open ~/.zshrc
3. 把 export OHPM_HOME=/Users/xx/Huawei/ohpm
      export PATH=${PATH}:${OHPM_HOME}/bin
   粘贴进去,保存即可
4. source ~/.zshrc
.zshrc
bash:
1. touch ~/.bash_profile
2. open ~/.bash_profile
3. 把 export OHPM_HOME=/Users/xx/Huawei/ohpm
      export PATH=${PATH}:${OHPM_HOME}/bin
   粘贴进去,保存即可
4. source ~/.bash_profile
.bash_profile

4、全局运行ohpm -v成功

image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容