Macports through a proxy

We have a proxy in work that prevents connections from being made out directly. I found out about the awesome MacPorts program, which is a bit like apt for OSX. It pulls backports from a repository and installs them for you.

There’s not a lot to the tool’s installation if you live on the open web, but I needed to do some stuff to get it working with our squid proxy.

If you run sudo port selfupdate, and get an error that says ‘port selfupdate failed: Couldn’t sync the ports tree’ or something like that, chances are your proxy is blocking rsync.

There are three steps. The prerequisites required for this to work are that you have the proxy address, admin access to your mac, and that the proxy supports the rsync port (873/tcp).

You can test the connectivity by going to http://rsync.macports.org:873, you should get the following error:

@RSYNCD: 30.0
@ERROR: protocol startup error

Step 1

If that works ok, then you need to set up the sudo environment for osx to let proxy environment settings through. First, edit your sudoers file with:
sudo visudo
Do not just edit /etc/sudoers

You need to append these lines:

Defaults env_keep += "http_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY"
Defaults env_keep += "ALL_PROXY NO_PROXY"

Step 2

Now, you need to set your http proxy
export http_proxy=http://proxy.example.com:8080
where 8080 is the port number of the proxy

Step 3

By Default, port uses rsync to manage its updates. RSync can use a proxy environment setting (man rsync for mre)
export RSYNC_PROXY=proxy.example.com:8080
Note the rsync proxy capitalisation, and the fact that it does not need http://

That should do it. You can then run selfupdate to get port to the latest version.

The hard way

If that doesn’t work, you can have a look at these instructions for replace rsync with subversion:
Syncing with SVN in Macports

Popularity: 100% [?]

This entry was written by Alex, posted on 18/03/2009 at 17:41, filed under OSX and tagged , , , , , , , . Leave a comment or view the discussion at the permalink.

Automatic Table Row Numbers in LaTeX

I am writing my thesis in LaTeX at the moment, and I highly recommend it. The main advantage is the ability to mark a document up with tags, such as section and chapter numbers, which count automatically. This means that it is possible to move parts of the document around transparently, and all the references numbers will change.

I was compiling a table with numbered rows, and after moving rows a few times, decided it might be handy to be able to automatically number the rows. The code below displays the arabic numerals, but it is easy enough to choose other values.

%Declare the Counter, then initialise it.
\newcounter{rownum}
\setcounter{rownum}{0}
% Table
\begin{table}[htbp]
\caption{Table Caption}
\begin{center}
\begin{tabular}{|c||l|l|}
\hline
\textbf{\#} & \textbf{Column1} & \textbf{Column2} \\ \hline \hline
%Increment then display the counter value
\addtocounter{rownum}{1}\arabic{rownum}. & Row1Cell2 & Row1Cell3 \\ \hline
\addtocounter{rownum}{1}\arabic{rownum}. & Row2Cell2 & Row2Cell3 \\ \hline
\addtocounter{rownum}{1}\arabic{rownum}. & Row3Cell2 & Row3Cell3 \\ \hline
\end{tabular}
\end{center}
\label{tablelabel}
\end{table}%

PDF output looks like this:
table

I suspect this can be shortened using \newcommand , but I haven’t done that yet.

Some Counter Documentation.

Update: A Comment from Stefan_T corrected a typo in the script. He also mentions that the \centering command might be better than using \begin{centre}.
For those of you who are interested, here is an article on the centering vs. centre issue. My thanks go out to Stefan_T for his help!

Popularity: 23% [?]

This entry was written by Alex, posted on 10/03/2009 at 18:28, filed under LaTeX and tagged , , , , , , . Leave a comment or view the discussion at the permalink.

Cutbacks everywhere

Even the amusing sign industry has suffered pain, obviously losing writers and graphic artists:

Popularity: 2% [?]

This entry was written by Alex, posted on 23/02/2009 at 15:45, filed under Found on the Web and tagged , , , , , . Leave a comment or view the discussion at the permalink.

« Previous Entries
» Next Entries