如何在Mac搭建golang環境

2021-10-01 03:55:43 字數 844 閱讀 6682

最近學一下go語言,需要在mac上搭建go的開發環境。

我比較喜歡用zsh命令列工具,我就從裝zsh說起吧

$ sh -c "$(curl -fssl "
啟用zsh:

$zsh
安裝go的話,去官網看就行了,很詳細。

安裝完成後,新增go的path環境變數

指定開發檔案,設定gopath

編輯.zshrc

vim ~/.zshrc
主要內容是這樣的

export gopath=~/desktop/gopath

export path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/local/go/bin:~/desktop/gopath/bin

如果zsh安裝後不能正常使用,則執行一下下面的這條命令,可以臨時恢復正常,注意:是臨時。可以把它加到.zshrc中,就可以永久正常。

export path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/kde/3.5/sbin:/usr/kde/3.5/bin:/usr/qt/3/bin"

如何在mac上搭建GitHub

準備工作 a 安裝git b 註冊github賬號1,檢查是否已經存在ssh目錄 開啟終端,輸入 cd ssh 如果是第一次操作,會顯示 no such file or directory2,生成金鑰 輸入 ssh keygen 接著連續3次回車即可3,檢查生成的金鑰檔案 輸入 ls 顯示 id r...

Mac搭建Apache PHP MySQL環境

安裝完成之後會有乙個彈窗,截圖儲存 開啟mysql,進入系統偏好設定 配置mysql的環境變數 在系統配置檔案.bash profile中新增mysql的路徑 如果不知道如何找到.bash profile,參考我的博文中有提及 export mysql home usr local mysql pa...

新手教程 如何在linux上搭建Go語言環境

yum install git git clone goroot cd goroot git checkout go1.14.7 cd src all.bash 如果安裝過程中報了這樣的錯誤 error cannot find root go1.4 bin go 這個錯誤 是因為安裝了1.5版本以上...