How do I get GNU screen not to start in my home directory in OS X?
Solution 1
A better way to check what exactly is being run when you type screen
would be to run command -V screen
. This will tell you whether it's running a binary (in which case the full path will be given) or a shell alias, function, etc.
Another thing to check is whether there's a chdir
command in either your ~/.screenrc
or the system-wide screenrc
.
Solution 2
The screen(1)
man page describes the Screen chdir
command.
chdir [directory]
Change the current directory of screen to the specified directory or,
if called without an argument, to your home directory (the value of the
environment variable $HOME). All windows that are created by means of the
"screen" command from within ".screenrc" or by means of "C-a : screen
..." or "C-a c" use this as their default directory. Without a chdir command,
this would be the directory from which screen was invoked. …
My Screen configuration for a programming session includes the command
chdir "$HOME/Projects"
Solution 3
The first step is to make sure that screen isn't an alias.
Type alias
and look for screen
. Be warned that this list could be long. You may want to type alias | grep screen
to separate the wheat from the chaff.
If screen
turns out to be an alias for something like cd ~ && screen
you can remove this using unalias screen
.
Solution 4
I believe this web page here has your answer: http://code.google.com/p/silassewell/wiki/ScreenOSX
Related videos on Youtube
Benjamin Oakes
Ruby, JavaScript, and Web. If I made a contribution that helped you, please consider Flattr logo http://api.flattr.com/button/flattr-badge-small.png leaving a tip via Flattr. Maid I maintain the open source Maid project: Be lazy. Let Maid clean up after you, based on rules you define. It's easy to install on a Mac or Linux. See instructions at http://rubygems.org/gems/maid TabCarousel I maintain an open source Chrome extension to help you keep tabs on info you want to monitor. Great for a TV or other external display. Install it from the Chrome Web Store.
Updated on September 17, 2022Comments
-
Benjamin Oakes almost 2 years
GNU Screen (
screen
) behaves differently on OS X 10.5 (Leopard) and 10.6 (Snow Leopard) compared to Linux (at least Ubuntu, Red Hat, and Gentoo) and OS X 10.4 (Tiger). In 10.5 and 10.6, new screens (made withscreen
or^A
c
) always places me in my home directory~
. In Linux and OS X Tiger, new screens have apwd
of wherever the screen was created originally.Made up examples to illustrate what I mean:
Tiger:
$ cd ~/foo $ pwd /Users/ben/foo $ screen $ pwd /Users/ben/foo $ screen # or ^A c $ pwd /Users/ben/foo
Leopard, Snow Leopard:
$ cd ~/foo $ pwd /Users/ben/foo $ screen $ pwd /Users/ben $ screen # or ^A c $ pwd /Users/ben
How do I get Leopard and Snow Leopard to behave like Tiger used to?
-
Benjamin Oakes over 14 yearsFinally found out what was doing it. I had
shell -$SHELL
in a section copied from a coworker. The problem went away when it was removed. It doesn't behave the same way as on Linux, etc. -
thiagowfx about 6 yearsEven better: use
type screen