RVM - MacPorts won't update through proxy

我是研究僧i 提交于 2019-12-03 16:33:00

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 $?
}

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.

run "__rvm_try_sudo port -dv selfupdate" in terminal and type in password by keyboard then re-run the script to install ruby

It works on my laptop

Good luck

Abdo

You need to (re)install the command lines tools first:

sudo xcode-select --install

then, update macports:

sudo port -v selfupdate

Source: https://stackoverflow.com/a/19634495/226255

Then, you might be missing some requirements so do:

sudo rvm requirements
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!