72

I am trying to selfupdate my Macports, but I am getting the following message:

Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing 
MacPorts sources: command execution failed

I checked my /opt/local/bin/macports and the directory does not exist. Instead, it is in /opt/local/var. Could that be the issue?

Running with -dt, I get the following:

[Users/user] > selfupdate
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/base
--->  Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Connection refused (61)
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/base/ /opt/local/var/macports/sources/rsync.macports.org/release/base
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

What is error 61? Any ideas how I can fix that?

nbro
  • 15,395
  • 32
  • 113
  • 196
darksky
  • 20,411
  • 61
  • 165
  • 254
  • 6
    Are you behind a firewall ? [here](https://trac.macports.org/ticket/20436) is a ticket similar to your issue. – Olwaro Jul 15 '12 at 14:44
  • Ah, I remember... I once ran into that, too. The trac ticket behind Olwaro's link contains [a link to the macports FAQ](https://trac.macports.org/wiki/FAQ#selfupdatefails). Was searching for ages back then... ty and +1! – nobody Jul 15 '12 at 22:09
  • possible duplicate of [Macport self update failed](http://stackoverflow.com/questions/10821755/macport-self-update-failed) – outis Feb 12 '13 at 01:40

11 Answers11

119

I had this same problem recently, and I forgot to run the command under root. If anyone else is having the problem, be sure to run command as so:

sudo port selfupdate
nbro
  • 15,395
  • 32
  • 113
  • 196
Eric K.
  • 1,349
  • 2
  • 8
  • 6
  • 7
    That is not the error in the question - he can't run self update as behind a firewall - fif just needing sudo there would be a different error – mmmmmm Feb 26 '14 at 11:56
46

I was behind a firewall. Tried on a different network and it worked.

darksky
  • 20,411
  • 61
  • 165
  • 254
  • 3
    Exactly my problem. Company firewall appeared to be blocking the connection. – Apollo Jul 18 '13 at 09:43
  • 2
    In case you are not able to change a different network, try these two solutions below (try both of them together), it solves my problem perfectly: 1.[rvm-macports-wont-update-through-proxy](http://stackoverflow.com/questions/16520919/rvm-macports-wont-update-through-proxy) ; 2.[rvm-install-issue-unable-to-execute-port-autoconf](http://stackoverflow.com/questions/17086996/rvm-install-issue-unable-to-execute-port-autoconf) – Jing Li Oct 02 '13 at 10:31
  • I was able to open/enable/allow port 873 (rsync daemon's port) for my router's firewall to resolve the issue. – Brent Self May 20 '15 at 23:12
  • University's eduroam firewall was the issue in my case. – fabiomaia Apr 21 '19 at 14:43
21

There is no /opt/local/bin/macports. The executable you need is /opt/local/bin/port. (Port files are in /opt/local/var/..., which is correct.)

Based on the command execution failed:

  • you might have forgotten to run as root.
  • port forks the following programs: rsync, tclsh, openssl, tar, chmod, chown. Are these executable and in the PATH? (Is /opt/local/bin in your PATH as well?)

If that doesn't help, run port with -dt to get all sorts of debug info. That might help with finding the problem. Append the interesting parts to your question, maybe.

nobody
  • 4,074
  • 1
  • 23
  • 33
17

I faced the same issue.But I used to this method in the after.

Go to: $prefix/etc/macports/sources.conf (my path is like this):

/opt/local/etc/macports/sources.conf 

comment out the rsync entry, and add a new entry as follows:

#rsync://rsync.macports.org/release/tarballs/ports.tar [default]
https://distfiles.macports.org/ports.tar.gz [default]

After that you can run:

sudo port -d sync

It's also explained on MacPorts.com.

rawr
  • 20,481
  • 4
  • 44
  • 78
beautifulcode
  • 364
  • 3
  • 6
14

Update for Mavericks: to ensure the XCode command line tools are installed, open a terminal and run xcode-select –-install, then follow the instructions in the resulting pop-up window:

  • accept license

Of course, this is in addition to the other tips such as making sure to run sudo port selfupdate.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
Miles
  • 141
  • 1
  • 3
11

If anybody else is having this issue and they've recently updated XCode, the root of my problem was that Command Line Tools had been omitted from the latest build.

Opening XCode and installing Command Line Tools via the XCode preference panel fixed this error being thrown by MacPorts.

pbab_13
  • 111
  • 1
  • 2
5

If your company block the access via rsync you can use the http tarball. Explained here

Hope this helps.

EDIT: Now prefer to use homebrew

iGranDav
  • 2,450
  • 1
  • 21
  • 25
4

I too had the same error. It is because the network connection is rejected. If you are using University/Company WiFi or public connection, firewall would be refusing the connection.

As you can see from the output of -dt "rsync: failed to connect to rsync.macports.org: Connection refused (61)"

There are workarounds available which are provided on the macports site:

1) Using svn.

2) If svn fails too, you can try using Daily tarball.

You can test the changes by running "sudo port -d sync"

Note: If the https fails, you can replace it with http. But doing so is not recommended, as you will be fetching from insecure connection.

JacksonIsaac
  • 97
  • 1
  • 1
  • 5
2

I faced the same issue. The main problem was my network. Because the NETWORK Port was blocked for;

rsync://rsync.macports.org/release/tarballs/ports.tar

Try to use use another network.

mmohab
  • 2,303
  • 4
  • 27
  • 43
Koza
  • 51
  • 2
  • This was the problem for me. Signed out of corp wifi, tried on another network and it worked fine – Thomas Jan 30 '16 at 01:16
1

for someone who's problem still exists, maybe you've forgot agree the Xcode license:

# sudo xcodebuild license

remember to look through and type 'agree' in the end.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
rain cheng
  • 71
  • 1
  • 5
0

In my case, the problem was internal to Macports! I updated rsync (the one delivered by Apple is old) with Macports and then Macports failed to use it (/opt/local/bin/rsync) but asked instead to use /usr/bin/rsync which does not exist (or has been erased to force using Macports rsync ?). I created a soft link between the two and now it works again.