CS 246: How to work from home
Prof. Richard Eisenberg
Spring 2017
This course is designed around the software that is available in the CS labs. (CS labs at both campuses have the requisite software.) You may have the best experience working at the lab computers. However, if that is not feasible, it is very possible to work from home. This page has some instructions on how to do this effectively.
Mac OS X is actually a variant of UNIX, just like Linux is a variant of UNIX. This means that you will be able to complete your assignments on your computer quite nicely. To get to the command line, just launch the Terminal app (in the Utilities folder under Applications, or available via Spotlight). From here, you can cd
and ls
all you like.
When you try to use gcc
, you may be told that you need to download XCode. If so, follow the instructions or search online to learn how to set up gcc
on your machine – it’s not generally too hard to get this working.
There are a few extra packages to install, beyond gcc
. To install these, I recommend using Homebrew. That site has installation instructions. (Note that it uses the command line!) After getting Homebrew installed, do the following:
brew install check
brew install gdb
You will also want a sturdy editor. I recommend emacs, available from http://emacsforosx.com/, but other editors like vim
, Atom, Sublime, and TextWrangler are good to. Don’t use TextEdit!
With these installed, you should be good to go, pretending your Mac is a Linux machine just like in the lab.
If you don’t want to worry about setting software up on your own machine, you are welcome to connect to Bryn Mawr’s CS server, powerpuff
. Just open Terminal and say ssh
<your CS username>@powerpuff.cs.brynmawr.edu
. You will then have command-line access to the CS server, from where you can run emacs
and start programming.
When you need to copy files back and forth between your machine and the server, you can use scp
, which is described on page 185 of our Linux book. (It’s the same on a Mac as it is on Linux.)
An alternative approach here is to sshfs
, which allows you to access your networked home directory as if it were local. First, install FUSE for MacOS, and then install sshfs
(available on that same page). Once installed, you can mount your networked home directory locally:
Create an empty directory anywhere. To be concrete, I’ll make one called cs
in my home directory with
cd
mkdir cs
Then just say sshfs -o auto_cache
<your cs username>@powerpuff.cs.brynmawr.edu:
<your empty directory>. Continuing my example, I would type
sshfs -o auto_cache rae@powerpuff.cs.brynmawr.edu: cs
Note the :
at the end of the address! Then, you should see your networked home directory in cs
. Any file you write in the cs
directory also gets copied to the server. This way, you can edit locally (with emacs or Atom on your own computer) but still compile on powerpuff via ssh
.
If you want to disconnect, just say umount
<your empty directory>. In my case, that’s umount cs
.
See also the last section here about some advice about working remotely.
Windows does not have nearly the power of a Mac when it comes to programming. It is possible to get everything working on Windows, but it’s not easy. Given the wide range of situations out there, all I can do here is recommend a few starting points – it will be up to you to get all the software working, I’m afraid.
Install cygwin. During installation, it seems that you will be able to install gcc
, emacs
, make
, check
, gdb
, and git
the extra packages you will need for this class.
Windows also does not come with a built-in ssh
(Secure SHell) client. Download PuTTY, both the putty.exe
and pscp.exe
files. Launching putty.exe
, you will be able to configure a connection to powerpuff.cs.brynmawr.edu
, using your CS username. It is worthwhile looking through the other settings available, as tweaking them may prove fruitful. The pscp.exe
program will allow you to copy files back and forth between your computer and the server.
Once you have logged in with PuTTY, you should be able to run emacs
, and away you go.
An alternative approach is to use SSHFS, which allows you to access your networked home directory as if it were local. This guide is up-to-date and seems reasonable, but I have not tested it myself. The Host should be powerpuff.cs.brynmawr.edu
; other settings should be straightforward. If you try this and have thoughts you wish to share, edit this page and submit a pull request.
See also below for some advice about working remotely.
When working via ssh
or PuTTY, you do not have direct access to the files you are working with. (For example, you can’t just save files from web pages into the server.) While you can always use scp
or pscp.exe
, this is often inconvenient. Below are some tips for common scenarios:
Use multiple windows! It is always possible to have multiple ssh
or PuTTY sessions at the same time. This is much easier than exiting emacs every time you wish to compile!
If you need to download a file from the web, from URL http://example.com/file.txt, use wget http://example.com/file.txt
.
Some terminals have a hard time with emacs’s M-
key. So any M-blah
command in emacs can also be executed by typing ESC blah
. So, instead of M-x
, you would type ESC x
. Note that ESC
and x
are not typed at the same time here.
Check out the emacs reference card.
Have a tip to add? Create a pull request!