duafagm1066 2015-06-07 18:45
浏览 79

继续进行IntelliJ:缺少SDK /环境变量

I'd like to learn Go and attempted to setup the Go plugin for IntelliJ on IntelliJ IDEA 14.1.3. I'm running OSX Yosemite (10.10.3).

I installed go using Brew: brew install go.

I'm unable to setup the SDK as I go through the new project wizard. The Project SDK is empty, when I click 'Configure', and navigate to the libexec folder of the installation (/usr/local/Cellar/go/1.4.2/libexec/), the Project SDK never is never displayed in the box. If I click through the wizard, it warns me that no SDK was specified, and then warns that GOROOT and GOPATH env variables are empty of could not be detected.

It seems there are quite a few ways to set environment variables on OSX. I created an ~/Library/LaunchAgents/environment.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv GOROOT "/usr/local/Cellar/go/1.4.2/libexec/"
    launchctl setenv GOPATH "/Users/awoolford/golang/"
    </string>

  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

If I run launchctl load -w ~/Library/LaunchAgents/environment.plist the environment variables are loaded:

$ launchctl getenv GOPATH
/Users/awoolford/golang/

$ launchctl getenv GOROOT
/usr/local/Cellar/go/1.4.2/libexec/

I would have expected IntelliJ to recognize these environment variables, and that I'd be able to create a project in ~/golang/.

Can you see what I'm doing wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码