Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM - MacPorts won't update through proxy

I'm trying to use RVM to install ruby on my iMac.

I start by typing the following:

rvm list known

I then target the version that I want to install (the guide I'm following recommends 1.9.2 instead of the base 1.8.7) with the following line:

rvm install 1.9.2

Then I get this:

27698AM:~ butler15$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.7/x86_64/ruby-1.9.2-p320.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:

I enter my password and I get this:

DEBUG: Copying /Users/butler15/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
--->  Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Operation timed out (60)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed

If I understand correctly it's trying to update MacPorts but fails due to being behind a proxy (or something?)

I've tried following this guide but it didn't work: http://samkhan13.wordpress.com/2012/06/15/make-macports-work-behind-proxy/

Further Information:

My current version of RVM and RUBY: http://d.pr/i/H1Eu

My OSX - 10.7.4

Thanks in advance for your help :)

like image 525
Midgar777 Avatar asked Dec 21 '22 05:12

Midgar777


2 Answers

While Koji's comment makes RVM work behind a proxy, Macports will need to be updated to automatically work behind a proxy as well.

First, install macports from the package at http://www.macports.org/install.php

Then run the following commands:

sudo mkdir -p /opt/local/var/macports/sources/svn.macports.org/trunk/dports/
cd /opt/local/var/macports/sources/svn.macports.org/trunk/dports/

sudo svn co http://svn.macports.org/repository/macports/trunk/dports/ .

In /opt/local/etc/macports/sources.conf comment out

rsync://rsync.macports.org/release/tarballs/ports.tar [default]

with your favorite editor and then add this right below that line.

file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]

And then run these commands so that it updates and doesn't complain about your ports not being indexed.

sudo port -d sync
sudo portindex

Then modify .rvm/scripts/functions/requirements/osx_port by changing selfupdate to sync in the requirements_osx_port_update_system() function.

requirements_osx_port_update_system()
{
  #__rvm_try_sudo port -dv selfupdate || return $?
  __rvm_try_sudo port -dv sync || return $?
}
like image 108
Steropes Avatar answered Dec 22 '22 17:12

Steropes


If you are trying MAKE MACPORTS WORK BEHIND PROXY, How about avoiding port selfupdate?

$ diff -u .rvm/scripts/functions/requirements/osx_port.org .rvm/scripts/functions/requirements/osx_port
--- .rvm/scripts/functions/requirements/osx_port.org    2013-05-28 16:58:37.000000000 +0900
+++ .rvm/scripts/functions/requirements/osx_port    2013-05-28 16:58:50.000000000 +0900
@@ -82,7 +82,7 @@

 requirements_osx_port_update_system()
 {
-  __rvm_try_sudo port -dv selfupdate || return $?
+  __rvm_try_sudo port -dv sync || return $?
 }

 requirements_osx_port_define()

In my case, it works fine.

like image 38
Koji NAKAMURA Avatar answered Dec 22 '22 17:12

Koji NAKAMURA