How do I add Ruby to the PATH variable on Windows?

前端 未结 7 1978
梦如初夏
梦如初夏 2020-12-01 16:16

I have Ruby installed, but I still need to add it to the PATH variable. I found something online for how to manually add it using the command line:

set PATH=         


        
相关标签:
7条回答
  • 2020-12-01 16:51

    first, notice that this question is not really about Ruby, rather about how to set a path in windows (it work the same way if you want to add an executable different from Ruby)

    second, you are not overwriting the PATH environment variable because you add the existing content of the same to the new one you are setting in:

    set PATH=C:\Ruby200-x64\bin;%PATH%
    

    the %PATH% is the current content of the PATH variable.

    Consider using

     set PATH=%PATH%;C:\Ruby200-x64\bin
    

    instead, this will make your OS search the original path before searching the ruby bin folder. Maybe it makes few difference on modern computers, but my old DOS days claim the second solution is better.

    third and last point, in Windows you can set environment variables in control panel / system properties How to get there depends on the version of your OS, but if you search for the ambient variables and system variables you should get there.

    0 讨论(0)
提交回复
热议问题