MacOS : brew install package throws a proxy issue in terminal - macos

I am banging my head trying to find out from where is the proxy being read from.
Here is the background. I am trying to do brew install wget on the Mac terminal
However, I immediately get fatal: unable to access 'https://github.com/Homebrew/brew/': Failed to connect to xxxxproxy.proxy.proxy.com port 8080: Connection refused
I tried to remove the HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, http_proxy, https_proxy, all_proxy. When I run echo $xxxxx_proxy for all the above variables, I get blank values, indicating that the proxies are unset.
Where is this proxy being read from? Any help/guide would be really appreciated. Thank you!
Edit: I might have posted a very silly question, or maybe the question is a duplicate (which I am not able to find here). If so, I apologize in advance :)

It seems that the .gitconfig file in my home /Users/<username>/.gitconfig had the proxy values set within it. As soon as I commented those, everything started working smoothly.
#[http]
# proxy = xxx.xxx.xxx.com:80
#[https]
# proxy = xx.xxx.xxx.com:80

To use brew package behind a proxy you should set variable ALL_PROXY
export ALL_PROXY=proxyIP:port
If you want to remove the proxy definition and use direct connection execute in terminal:
unset ALL_PROXY
and in the same terminal execute the command

Related

Download a file from FTP via proxy with Ruby

I have an app running on Heroku, and I need to download a file from an FTP. But I need to do it using a fixed IP. I´m using www.quotaguard.com to have fixed IPs.
But I can´t get it working.
Does anyone has a Ruby example to download a file from an FTP via a proxy server (quotaguard).
Both the proxy server and the FTP require username and password.
I´ve tried everything, using Ruby. And also calling wget from system to initiate a download, but wget apparently doesn´t go via the proxy. Also checked many posts, but no success so far.
I´m using Ruby 2.4.5
Thanks for any comments.
Thank you QuotaGuard. Socksify is not maintained and really old, we gave it a try but didn´t want to spend much time on it.
We actually managed to get this working with curl. You can call it within Heroku as well.
Here´s the command in case anyone wonders.
curl -x socks5h://socksproxyurl 'ftp://theftp/some.pdf' --user "ftp_user:ftp_pass" -o some.pdf
We've seen a few customers do this before with the socksify gem.
require 'socksify'
proxy = URI(ENV['QUOTAGUARDSTATIC_URL'])
TCPSocket::socks_username = proxy.user
TCPSocket::socks_password = proxy.password
Socksify::proxy(proxy.hostname, 1080) do |soc|
# do your FTP stuff in here
end
If that doesn't do it, post the errors you're seeing and we'll help get this running for you.

"https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out

This morning, I ran this command
composer create-project laravel/laravel laravel-4.2 4.2 --prefer-dist
I kept getting
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Anyone know how to avoid this ?
For me, this wasn't an issue with my internet connection speed, but it was a issue with IPv6 resolution of "repo.packagist.org". I got around this issue by adding the IPv4 address to my hosts file. It's a hack, but it works.
# dig +short repo.packagist.org
142.44.164.255
# echo "142.44.164.255 repo.packagist.org" >> /etc/hosts
More details here!
try this solution worked for me!
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
and run composer:update once again. If not then run composer self-update
I got the answer here and it works like voodoo...
For me it was ipv6, I disabled it using: networksetup -setv6off Wi-Fi on macOS. Worked like a charm.
Solution found here: https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
The problem is most likely with your internet connect. Just try with another (or a more reliable) source of internet.
If problem persists, and you are sure of your internet connection, then checkout suggestions here.
I have heard this problem can occur if you live in an area behind a government firewall, you might want to test if it works when behind a VPN.
This question is similar to this: Installing laravel suddenly some json file cannot be downloaded
This is the answer that worked for me:
This worked on Linux. It prioritizes ipv4 over ipv6
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
This problem occurs for your low speed or bad connection. It failed to access internet and download repository.
Check your internet connection and try again to connect your console to the internet.
Mostly it happens when you did not get the response from the server.
1. check internet connection.
2. check any proxy block your response from the server.
3. if block proxy. When installing the composer that time you set proper proxy configuration on your installation process.
4. You should check your admin user privilege.
5. If you guest or limited account. You can not download any file from the outside server.
The problem is due to slow internet connection or no internet. If there is no internet then The packages are unable to download from the server. that's why it gives this error i had face many time.
Switch to a mirror according to your location :
https://packagist.org/mirrors
Especially if you're in China.
On linux, it seems that running this command helps to make ipv4 traffic have a higher prio than ipv6, which is a better alternative than disabling ipv6 entirely:
Workaround Linux:
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"enter image description here
export no_proxy=.github.com,.getcomposer.org
You can just add this code in your composer directory and hit enter. Then try again. While I was working on Magento 2 sample data deployment, I got the same error. This code did help me to continue the process.
Forcing the use of https with composer fix this. For anyone else who sees this, run the following to force composer to use https.
composer config -g repo.packagist composer https://packagist.org
Clearing the DNS cache fixed this for me.
In the terminal execute:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Can't use Maven through a proxy with a Vagrant machine

I'm currently using JHipster on their DevBox (XUbuntu) through a proxy.
I configured everything I could think about in it to use it through a proxy, mainly with the vagrant-proxyconf plugin and by exporting MAVEN_OPTS in a shell script inside /etc/profile.d.
npm install works fine, same for apt-get or Firefox.
However, mvn, telnet or ping keep giving me "Connection timed out" errors, with repo1.maven.org or google.com, even if I give the proxy options as parameters of mvn directly.
Ok found the problem...
To use Maven through a proxy you can set the MAVEN_OPTS environment variable like this: -Dhttp.proxyHost=<domain> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<domain> -Dhttps.proxyPort=<port> for a proxy URL like this: <protocol>://<domain>:<port>.
I simply used <protocol>://<domain> instead of <domain>...
But ping and telnet still won't work, even if the HTTP(S)_PROXY environment variables, lower and uppercase, are set. Well, I don't really need them so it's just strange but not harmful.

GUI programs won't open in an ssh server. ssh -X and downloading XQuartz have not helped

So I use a remote server for some of my schoolwork and have no trouble logging onto the machine and navigating. The problem arises when I attempt to run a software that uses a GUI called ds9. It's used for image processing but I don't think that is relevant. Anyways, I've tried ssh -X username#university.edu, I've downloaded XQuartz, and I've made sure XQuartz's Security preferences are all checked. Still, I receive the same error message: Application initialization failed: no display name and no $DISPLAY environment variable
Unable to initialize window system.
I would be extremely grateful if anybody could identify the issue.
It may happened that you set a wrong DISPLAY env. var. at login time on the server. In general, ssh -X set the value to something like DISPLAY=localhost:10.0 (a tunnel set up by ssh in between your server and your local machine).

Configuring mercurial to use a proxy gives error "abort: error: ''"

Adding a proxy section to my ~/.hgrc file doesn't seem to work, nor does
setting the proxy on the command line; e.g.
$ hg --config=http_proxy.host=http://127.0.0.1:8181 incoming
The proxy section in my ~/.hgrc file looks like:
[http_proxy]
host=http://localhost:8181
Instead, I get a not so informative response printed to stderr:
abort: error: ''
After some investigation, (adding --debug --traceback) I found this error
happens in the keepalive.py file of one of the underlying python library files.
I have Firefox/foxyproxy set up to use this same proxy, and everything works
fine - the port number [and host] is correct.
After a few minutes I realised my proxy is set up as a socks proxy, and that
mercurial doesn't work with socks proxies. The fact that the section heading is
http_proxy was the give-away hint.
I installed polipo, set it to use the socks proxy as it's parent, and
configured mercurial in the ~/.hgrc file to use this proxy instead.
Everything is working nicely now. (And I've also set firefox to use it instead
as it caches files as required too).

Resources