Cannot disable proxy to install Homebrew on OS X - macos

I'm experiencing the exact same issue as mentioned in this question, but there are no answers addressing the issue.
I'm currently on my home network and trying to install Homebrew, but it fails as the terminal cannot connect to my corporate proxy. The answers in the question describe how to specify more clearly the proxy you're using to prevent this, but I do not have a proxy at all on my own wifi network. Is there a way to simply remove the proxy settings entirely? I've disabled all proxies in my System Preferences, and unset http_proxy in the shell, but it doesn't help.
In fact, there are no environment variables containing the proxy information anywhere, so I have no idea where curl is getting the information from to begin with. I've tried running the curl command with the --no-proxy flag, and even deleted the variables in my NPM config, since that's the only place I can think of that the proxy URL is currently specified. Still no luck.
Any assistance greatly appreciated!

I figured it out. Since curl is actually downloading Homebrew through Github, it was being routed through the proxy that was set in my global Git configuration, not in my environment variables. If anyone else runs into this:
git config --global --unset http.proxy
Did the trick.
Thanks, me!

Related

git ssh authentication fails with ssh_askpass: posix_spawn: Unknown error

I am using a setup on Windows 10 x64 where I install and manage git via scoop, rather downloading and executing the installer myself. Via the PowerShell, I ran
scoop install git
scoop install openssh
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')
However, now when I try to run commands in the Git Bash like
git clone git#example.org:vendor/repository.git
or a simple
git push/pull
I only get
CreateProcessW failed error:193
ssh_askpass: posix_spawn: Unknown error
instead of the Git Bash asking me for my SSH key's passphrase.
I am using the same setup (git installed via scoop) on many other Windows 10 x64 and no problems occur there. So I am not sure what is going wrong on this one. I previously had git installed without scoop on the same machine and the Git Bash was working fine. I uninstalled git completely (and also restarted the machine, just to be sure) before re-installing it via scoop instead.
The SSH_ASKPASS environment variable contains the following, in case this is relevant:
$ echo ${SSH_ASKPASS}
/mingw64/libexec/git-core/git-gui--askpass
Not sure what that folder refers to (something internal to the Git Bash presumably?), since it obviously does not exist like that on my machine.
Update
When using git-with-openssh instead of just git and openssh separately it works. However, I don't use that on my other machines, so I'd still like to know why it's not working here.
I'm pretty sure my answer does not address the OP's original case. But as of 2020, there seems to be a similar issue with a different way of solving it, and that's how I did in my case.
Part of the problem is, now Windows 10 has its own version of OpenSSH available, and at least in the case of my work's machine it seems that option is enabled by default.
This bundled OpenSSH is not compatible with Git bash though, so if you wants to use it, you must force git use scoop's provided OpenSSH (either from openssh or git-with-openssh packages). That means overwriting GIT_SSH environment variable, e.g. by adding a line similar to this to your .bashrc:
export GIT_SSH='C:\Users\rogs\scoop\apps\git-with-openssh\current\usr\bin\ssh.exe'
Hope it helps.
Even if this topic is already very old, the problem persists. I found out that its enough to simply unset the environment variable to get rid of this error.
unset SSH_ASKPASS
Just put this in your .bash_profile and/or your .bashrc.

conda update CondaHTTPError: HTTP None

Midway through running Conda Update --all, the update stalled. Multiple packages had been updated. Now, when I run conda update --all or conda update conda, I get this response:
(C:\Users\*****\AppData\Local\Continuum\Anaconda3) C:\Users\*****>conda update conda
Fetching package metadata ...
CondaHTTPError: HTTP None None for url <None>
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),),)
I've repeated conda update conda over multiple days, with no change in results. I can see there is no HTTP, however conda info --a shows channel URLs.
(C:\Users\*****\AppData\Local\Continuum\Anaconda3) C:\Users\*****>conda info -a
Current conda install:
platform : win-64
conda version : 4.3.13
conda is private : False
conda-env version : 4.3.13
conda-build version : 2.1.5
python version : 3.5.3.final.0
requests version : 2.13.0
root environment : C:\Users\*****\AppData\Local\Continuum\Anaconda3 (writable)
default environment : C:\Users\*****\AppData\Local\Continuum\Anaconda3
envs directories : C:\Users\*****\AppData\Local\Continuum\Anaconda3\envs
C:\Users\*****\AppData\Local\conda\conda\envs
C:\Users\*****\.conda\envs
package cache : C:\Users\*****\AppData\Local\Continuum\Anaconda3\pkgs
C:\Users\*****\AppData\Local\conda\conda\pkgs
channel URLs : https://conda.anaconda.org/anaconda-fusion/win-64
https://conda.anaconda.org/anaconda-fusion/noarch
https://repo.continuum.io/pkgs/free/win-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/win-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/win-64
https://repo.continuum.io/pkgs/pro/noarch
https://repo.continuum.io/pkgs/msys2/win-64
https://repo.continuum.io/pkgs/msys2/noarch
config file : C:\Users\*****\.condarc
offline mode : False
user-agent : conda/4.3.13 requests/2.13.0 CPython/3.5.3 Windows/7 Windows/6.1.7601
How do I get conda update to call a correct HTTP address?
My original answer got flagged as duplicate because I answered a similar question with the same answer, I wasn't aware that this is not allowed. I have marked my other response as a duplicate. Hopefully, this stays up!
I almost spent two days running in circles trying all the solutions I could find on the Internet, but here is what worked for me.
So, CondaHTTPError aka SSL module is not available error is caused by the missing/misplacement of libcrypto file in anaconda3/DLLs folder:
Tl;dr:
From anaconda3\Library\bin copy below files and paste them in anaconda3/DLLs:
- libcrypto-1_1-x64.dll
- libssl-1_1-x64.dll
Detailed answer:
Uninstall any Python versions you have (e.g. Python 3.7 or Python 3.8)
go to Control Panel--> Program and Features--> Select Python-->
uninstall
Uninstall any Anaconda versions you might have (e.g. Anaconda or miniConda)
For Anaconda:
go to Control Panel--> Program and Features--> Select Anaconda-->uninstall
For miniConda
go to Control Panel--> Program and Features--> Select miniconda--> uninstall
Delete any leftover Environment variables
go to Control Panel--> System--> Advanced System settings (on left side)--> in System Properties click on Environment Variables button--> in User Variable select Path and click the Edit button--> delete any path related to Anaconda, miniConda or Python.
E.g.
C:\Users\Bob \AppData\Local\Programs\Anaconda\...
C:\Users\Bob \AppData\Local\Programs\miniconda\...
b. If you don’t see any paths related to Anaconda, miniConda or Python; you are good to go.
Reboot your machine
Download the latest version of Anaconda
Run the Installer; keep all the default settings
Go to your anaconda3/library/bin folder:
E.g.C:\Users\Bob\AppData\Local\Continuum\anaconda3\Library\bin
Copy these files:
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
paste these in anaconda3/DLLs folder:
Reopen the Anaconda Prompt and test with any command that requires an Internet connection.
E.g.
conda update conda
Or with
conda update --all
Use the code below in your command line :
conda config --set ssl_verify no
Check if you're behind a corporate firewall that has an HTTPS/SSL proxy. If so, you may need to change the line in .condarc from ssl_verify: true to ssl_verify: false.
Or, as suggested by th0masb in the comments, using the command:
conda config --set ssl_verify false
Try to start Anaconda Prompt as Administrator (click right button of mouse before starting it), and make the same order.
Install the latest OpenSSl from this site: https://slproweb.com/products/Win32OpenSSL.html the current latest version is 1.1.1. Now I can install packages via pip and conda successfully.
I faced the same problem on Mac OS X and with Miniconda. After trying many of the proposed solutions for hours I found that I needed to correctly set Condas environment to use the Root certificate that my company provided rather than the generic ones that Conda provides.
Here is how I solved it:
Open Chrome, got to any website, click on the lock icon on the left
of the URL. Click on «Certificate» on the dropdown. In the next
window you see a stack of certificates. The uppermost (aka top line
in window) is the root certificate (e.g. Zscaler Root CA in my case,
yours will very likely be a different one).
Open Mac OS keychain, click on «Certificates» and choose among the many certificates the root certificate that you just identified. Export this to any folder of your choosing.
Convert this certificate with openssl: openssl x509 -inform der -in /path/to/your/certificate.cer -out /path/to/converted/certificate.pem
For a quick check set your shell to acknowledge the certificate: export REQUESTS_CA_BUNDLE=/path/to/converted/certificate.pem
To set this permanently open your shell profile (.bshrs or e.g. .zshrc) and add this line: export REQUESTS_CA_BUNDLE=/path/to/converted/certificate.pem. Now exit your terminal/shell and reopen. Check again.
You should be set and Conda should work fine.
PS: I'm aware that OP works on Windows. Nonetheless I leave this solution here because I think it can help solving the underlying root cause.
Type "conda config --show" to check the configuration information and make sure the addresses in the channels can be accessed normally.
I am using python 3.7.4 and I have just downloaded the conda and tried setting up the tensorflow but got http error.
I tried several steps mentioned above but it dint solve my problem.
I solved it by first activating conda. if you are using conda for first time you need to activate it using conda init command and then disable SSL verification conda config --set ssl_verify false
After above steps my tfp setup worked perfectly!!!
Download cacert.pem from https://curl.haxx.se/ca/cacert.pem,
save to /this/is/cert/path
open ~/.bashrc or any profile file you have
add export REQUESTS_CA_BUNDLE=/this/is/cert/path ...
open new terminal
conda update conda
You should check your .condarc file located in your Miniconda3/Anaconda3 root directory. There should be a line with just a hyphen. This line corresponds to the None channel. Deleting the line fixed the issue for me.
For the type of error above, you have to remove the proxy in environment variable. To do this follow this step :-
Open the Environment Variables window==>>>>>
To make many of the edits shown in this article, you first need to open the Environment Variables window. This guide explains how to open this window and shows you the basics about working with environment variables: Simple questions: What are environment variables in Windows?
If you want to skip reading it, one path that works the same in all versions of Windows is to open the Control Panel and go to “System and Security - > System.” There, click or tap the “Advanced system settings” link on the left. The System Properties window is opened. There click the Environment Variables button.
In this you have to select that one which have proxy , and delete ,then click Ok.
Now restart your Anaconda prompt.
It worked for me; I hope it also work for you.
Good luck
Enable 'k' flag in your conda update command. For example,
conda update anaconda-navigator -k
That will allow conda to make insecure connections to download packages. This is especially useful when you are behind a proxy server.
Try to type "conda update conda" from the (base) environment
The DLLs delivered by Anaconda3 are located here:
D:\Anaconda3\Library\bin
My workaround:
I have copied the following files
libcrypto-1_1-x64.*
libssl-1_1-x64.*
from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.
And it works as a charm!
Just need to add binaries into you path, and done - it will take care about your openssl and everything.
C:\Users\{username}\Miniconda3\Library\bin
Search environment variables, in both User and System variables. Add the bin location in Path. Put the path at the end without changing anything. Save Apply and re-open your terminal. It should be now allowing you to install libraries easily.
I had the same error, and I tried most of the methods, but none of them worked. I checked the version of anaconda3 it was 4.2.0 which I realized was in beta which might be the reason.
I solved it by uninstalling everything and installing the latest version (5.1.0). It worked after that.
Refer link for details
Please update to the latest version of Navigator.
On Navigator click on the update button on the top right of the interface or
on the terminal type
$ conda update anaconda-navigator
After reading FAR too many posts running around in circles, I found a simple solution at least to my flavor of this problem, which should also shed some light on root cause.
Using sudo of same command (see below)
conda create -n tensorenviron
(output below)
Solving environment: done
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/r/osx-64/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/r/osx-64/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))
sudo conda create -n tensorenviron
(output below)
Password:
Solving environment: done
## Package Plan ##
environment location: /Users/damonw/anaconda3/envs/tensorenviron
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate tensorenviron
#
# To deactivate an active environment, use:
# > source deactivate
#
I also faced the same problem and manually followed these steps to reach the desired result.
you can enter --> https://repo.anaconda.com/pkgs/main/win-64/
you can install packeges whatever you want and later :
you can write to Anaconda Prompt -->
conda install C:\Users\xxxx\Downloads\xlrd-1.2.0-py37_0.tar.bz2
Have a good luck!
Just in case anyone else is stuck behind a company proxy and the previous answers have not worked then try changing your proxies. Interestingly, I had already set my proxies in my environment variables but deleting them and then recreating them worked for some reason for me.
In my case, it was a proxy server setting that was blocking the installation. Switching the proxy server off and then connecting to a different WiFi got it working for me!
Tried everything to fix this issue. Hours of wasted time.
Reset Windows 10 firewall
downgraded/upgraded pip
downgraded/upgraded conda
tried new environments
installed pip from pypi (get-pip.py)
upgraded Debian on Windows environment
Nothing fixed it. Then noticed that other conda environments worked perfectly.
The issue was the pip cache was mangled if you reinstalled an environment with a name you used before and did some sort of upgrade of conda/distro in-between. Under linux i ran the following to fix the issue:
rm -rf $HOME/.cache
and looks like there is a similar setup for Windows based on the info you gave above.
I solved this by changing the proxy.
Change
https_proxy=https://xxx.xxx
to
https_proxy=http://xxx.xxx
make it works.

heroku error: Unable to connect to heroku API

I'm trying to access heroku from my command line, and I keep getting this same error: "Unable to connect to heroku API. Please check your internet connectivity and try again."
My internet connectivity is fine.
This question has been asked on StackOverflow before, but I don't quite understand the answer that seemed to be effective, as I'm a complete newbie. Apparently, it might have to do with an environment variable?
The other answer suggested a missing heroku remote branch, but mine is set up.
What, exactly, should I do to regain my connection with heroku?
Thanks!
Get the same message "Unable to connect to heroku API. Please check your internet connectivity and try again." when using heroku toolbelt on Mac.
In my case I installed the heroku toolbelt using homebrew. Installing the heroku toolbelt from https://toolbelt.heroku.com/ can solve the issue.
Well, it seems to have been a problem with my antivirus program . . . I reinstalled that, and heroku is accessible again.
If you’re behind a firewall that requires use of a proxy to connect with external HTTP/HTTPS services, you can set the HTTP_PROXY or HTTPS_PROXY environment variables in your local developer environment, before running the heroku command.
For example, on a Unix system you could do something like this:
$ export HTTP_PROXY=http://proxy.server.com:portnumber
or
$ export HTTPS_PROXY=https://proxy.server.com:portnumber
$ heroku login
On a Windows machine, either set it in the System Properties/Environment Variables, or do it from the terminal:
> set HTTP_PROXY=http://proxy.server.com:portnumber
or
> set HTTPS_PROXY=https://proxy.server.com:portnumber
> heroku login
I Got the same error on Mac OS X 10.13, and it's work for me, since I am behind the proxy,It's gathered from the Heroku Dev center page
https://devcenter.heroku.com/articles/using-the-cli

Git Bash on windows 7 behind proxy no longer working

I'm on a windows 7, 32 bit box, and working behind a proxy. I just upgraded my git client (Git Bash) to Git-1.8.3-preview20130601, and all of the sudden, I'm getting the following error whenever I try to push/pull:
fatal: unable to access 'https://github.com/User/simple_timesheets.git/:
Received HTTP code 407 from proxy after Connect
I was able to do this just fine before upgrading, and even when I tried to revert back to the last version that I think I had, I still get the error. When I run git config -l, it lists out the following variables (among others):
user.name=MyName
user.email=My#email.com
http.proxy=http://user:password#server:port
core.autocrlf=true
https.proxy=http://user:password#server:port
http.sslcainfo=/bin/curl-ca-bundle.crt
What's odd is that I seem to be able to use the Git Bash client to curl just fine
curl finance.yahoo.com --proxy http://user:password#server:port
and can even curl into a dummy https site I set up on my computer:
curl https://localhost:3000 --insecure
Any ideas what I'm missing? Thanks
EDIT:
I could be wrong, but I think there might be an issue with curl in version 1.8.3. I uninstalled all git related applications I could think of on my computer, and installed Git-1.8.0-preview20121022, ran a pull on a repo and was successful.
For giggles, I uninstalled the working version, and kept the cert file; then reinstalled version 1.8.3 to see if this didn't have anything to do with it, but I got the same error I was originally trying to resolve.
Also, after re-installing version 1.8.0, I tried to curl an https website (gmail), with the following command: curl https://www.gmail.com --proxy http://user:pass#server:port, which was successful. When I did this under 1.8.3, I got an error about code 407. The version switch seems like it solved this.
I had the same issue resolved it by using two proxy filters:
"--proxy or -x" and "--proxy-user".
curl -x http://proxyserverurl:port --proxy-user username:password -L http://url
Though what you have tried is also not wrong but might not be compatible with your curl version.
Hope this helps!
I had the same issue. Exporting the environment variables https_proxy and http_proxy resolved the issue. So I ended up adding the following lines to the .bashrc file in the home directory:
# Configure proxy settings
export https_proxy='http://myproxy.example.com:8086/'
export http_proxy='http://myproxy.example.com:8086/'

How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?
... or am I just being lazy?
Note: rubysspi-1.2.4 does not work.
This also works for "igem", part of the IronRuby project
For the Windows OS, I used Fiddler to work around the issue.
Install/Run Fiddler from www.fiddler2.com
Run gem:
$ gem install --http-proxy http://localhost:8888 $gem_name
I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my HTTP_PROXY environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:
SET HTTP_PROXY=http://%USER%:%PASSWORD%#%SERVER%:%PORT%
I set the four referenced variables before I get to this line obviously. As an example if my username is "wolfbyte", my password is "secret" and my proxy is called "pigsy" and operates on port 8080:
SET HTTP_PROXY=http://wolfbyte:secret#pigsy:8080
You might want to be careful how you manage that because it stores your password in plain text in the machine's session but I don't think it should be too much of an issue.
This totally worked:
gem install --http-proxy http://COMPANY.PROXY.ADDRESS $gem_name
I've been using cntlm (http://cntlm.sourceforge.net/) at work. Configuration is very similar to ntlmaps.
gem install --http-proxy http://localhost:3128 _name_of_gem_
Works great, and also allows me to connect my Ubuntu box to the ISA proxy.
Check out http://cntlm.wiki.sourceforge.net/ for more information
I tried some of these solutions, and none of them worked. I finally found a solution that works for me:
gem install -p http://proxy_ip:proxy_port rails
using the -p parameter to pass the proxy. I'm using Gem version 1.9.1.
Create a .gemrc file (either in /etc/gemrc or ~/.gemrc or for example with chef gem in /opt/chef/embedded/etc/gemrc) containing:
http_proxy: http://proxy:3128
Then you can gem install as usual.
This solved my problem perfectly:
gem install -p http://proxy_ip:proxy_port compass
You might need to add your user name and password to it:
gem install -p http://[username]:[password]#proxy_ip:proxy_port compass
If you are having problems getting authenticated through your proxy, be sure to set the environment variables in exactly the format below:
set HTTP_PROXY=some.proxy.com
set HTTP_PROXY_USER=user
set HTTP_PROXY_PASS=password
The user:password# syntax doesn't seem to work and there are also some badly named environment variables floating around on Stack Overflow and various forum posts.
Also be aware that it can take a while for your gems to start downloading. At first I thought it wasn't working but with a bit of patience they started downloading as expected.
Quick answer : Add proxy configuration with parameter for both install/update
gem install --http-proxy http://host:port/ package_name
gem update --http-proxy http://host:port/ package_name
I tried all the above solutions, however none of them worked. If you're on linux/macOS i highly suggest using tsocks over an ssh tunnel. What you need in order to get this setup working is a machine where you can log in via ssh, and in addition to that a programm called tsocks installed.
The idea here is to create a dynamic tunnel via SSH (a socks5 proxy). We then configure tsocks to use this tunnel and to start our applications, in this case:
tsocks gem install ...
or to account for rails 3.0:
tsocks bundle install
A more detailed guide can be found under:
http://blog.byscripts.info/2011/04/bypass-a-proxy-with-ssh-tunnel-and-tsocks-under-ubuntu/
Despite being written for Ubuntu the procedure should be applicable for all Unix based machines. An alternative to tsocks for Windows is FreeCap (http://www.freecap.ru/eng/). A viable SSH client on windows is called putty.
Posts abound regarding this topic, and to help others save hours of trying different solutions, here is the final result of my hours of tinkering.
The three solutions around the internet at the moment are:
rubysspi
apserver
cntlm
rubysspi only works from a Windows machine, AFAIK, as it relies on the Win32Api library. So if you are on a Windows box trying to run through a proxy, this is the solution for you. If you are on a Linux distro, you're out of luck.
apserver seems to be a dead project. The link listed in the posts I've seen lead to 404 page on sourceforge. I search for "apserver" on sourceforge returns nothing.
The sourceforge link for cntlm that I've seen redirects to http://cntlm.awk.cz/, but that times out. A search on sourceforge turns up this link, which does work: http://sourceforge.net/projects/cntlm/
After downloading and configuring cntlm I have managed to install a gem through the proxy, so this seems to be the best solution for Linux distros.
A workaround is to install http://web.archive.org/web/20060913093359/http://apserver.sourceforge.net:80/ on your local machine, configure it and run gems through this proxy.
Install: Just download apserver 097 (and not the experimental 098!) and unpack.
Configure: Edit the server.cfg file and put the values for your MS proxy in PARENT_PROXY and PARENT_PROXY_PORT. Enter the values for DOMAIN and USER. Leave PASSWORD blank (nothing after the colon) – you will be prompted when launching it.
Run apserver: cd aps097; python main.py
Run Gems: gem install—http-proxy http://localhost:5865/ library
I am working behind a proxy and just installed SASS by downloading directly from http://rubygems.org.
I then ran sudo gem install [path/to/downloaded/gem/file]. I cannot say this will work for all gems, but it may help some people.
This worked for me in a Windows box:
set HTTP_PROXY=http://server:port
set HTTP_PROXY_USER=username
set HTTP_PROXY_PASS=userparssword
set HTTPS_PROXY=http://server:port
set HTTPS_PROXY_USER=username
set HTTPS_PROXY_PASS=userpassword
I have a batch file with these lines that I use to set environment values when I need it.
The trick, in my case, was HTTPS_PROXY sets. Without them, I always got a 407 proxy authentication error.
If you are on a *nix system, use this:
export http_proxy=http://${proxy.host}:${port}
export https_proxy=http://${proxy.host}:${port}
and then try:
gem install ${gem_name}
rubysspi-1.3.1 worked for me on Windows 7, using the instructions from this page:
http://www.stuartellis.eu/articles/installing-ruby/
If you want to use SOCKS5 proxy, you may try rubygems-socksproxy https://github.com/gussan/rubygems-socksproxy.
It works for me on OSX 10.9.3.
If behind a proxy, you can navigate to Ruby downloads, click on Download, which will download the specified update ( or Gem ) to a desired location.
Next, via Ruby command line, navigate to the downloaded location by using : pushd [directory]
eg : pushd D:\Setups
then run the following command: gem install [update name] --local
eg: gem install rubygems-update --local.
Tested on Windows 7 with Ruby update version 2.4.1.
To check use following command : ruby -v
Rather than editing batch files (which you may have to do for other Ruby gems, e.g. Bundler), it's probably better to do this once, and do it properly.
On Windows, behind my corporate proxy, all I had to do was add the HTTP_PROXY environment variable to my system.
Start -> right click Computer -> Properties
Choose "Advanced System Settings"
Click Advanced -> Environment Variables
Create a new System variable named "HTTP_PROXY", and set the Value to your proxy server
Reboot or log out and back in again
Depending on your authentication requirements, the HTTP_PROXY value can be as simple as:
http://proxy-server-name
Or more complex as others have pointed out
http://username:password#proxy-server-name:port-number
for anyone tunnelling with SSH; you can create a version of the gem command that uses SOCKS proxy:
Install socksify with gem install socksify (you'll need to be able to do this step without proxy, at least)
Copy your existing gem exe
cp $(command which gem) /usr/local/bin/proxy_gem
Open it in your favourite editor and add this at the top (after the shebang)
require 'socksify'
if ENV['SOCKS_PROXY']
require 'socksify'
host, port = ENV['SOCKS_PROXY'].split(':')
TCPSocket.socks_server = host || 'localhost'
TCPSocket.socks_port = port.to_i || 1080
end
Set up your tunnel
ssh -D 8123 -f -C -q -N user#proxy
Run your gem command with proxy_gem
SOCKS_PROXY=localhost:8123 proxy_gem push mygem

Resources