mparson at bl.org
Sun Apr 8 02:23:48 UTC 2018
On Sat, 7 Apr 2018, Murray Eisenberg wrote:
> I’m trying to install the port of OpenModelica. The instructions at https://www.openmodelica.org/download/download-mac <https://www.openmodelica.org/download/download-mac> give, as first step:
> echo rsync://build-openmodelica.org/macports/ >> /opt/local/etc/macports/sources.conf
> But even with sudo, I’m getting a "Permission denied" error.
> How to fix this?
I know I'm for offering a solution to you for this one case, but it can
be done with 'sudo' with a trick. The 'sudo' command, by design, does
not allow you to directly redirect output to a file. It's a (minimal)
security feature, to prevent people from using sudo that is more locked
down to certain commands from being able to use sudo to modify files
they might otherwise not have permission to...
The workaround is to use the 'tee' command:
echo rsync://build-openmodelica.org/macports/ | sudo tee -a /opt/local/etc/macports/sources.conf
The 'echo' will be sent to your screen as well as appended to the
designated file via the 'tee'. The '-a' flag tells it to append, which
is what your '>>' in the original command would have done.
More information about the macports-users