# Rails on a Mac, so strange (to me) behavior

**URL:** <https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211>\
**Category:** Ruby\
**Created:** [June 7, 2007, 4:55pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211 "2007-06-07T16:55:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 7, 2007, 4:55pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/1 "2007-06-07T16:55:39Z")

</div>

I have built Ruby from source, installed gems & rails on a MacBook  
pro. I installed the source for a working Rails application in a  
directory /rails\_apps. I cd to the application directory under rails  
apps and in the terminal I enter:

script/server

Terminal responds:  
: No such file or directory

sudo script/server provides the same response  
ls -la script/server returns:  
-rwxr-xr-x 1 pogo admin 98 Nov 13 2006 script/server

I have all of 2 weeks experience on a Mac, which probably explains the  
basic problem. Can someone advise?

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 7, 2007, 5:03pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/2 "2007-06-07T17:03:55Z")

</div>

Mark wrote:

> I have built Ruby from source, installed gems & rails on a MacBook  
> pro. I installed the source for a working Rails application in a  
> directory /rails\_apps. I cd to the application directory under rails  
> apps and in the terminal I enter:
> 
> script/server
> 
> Terminal responds:  
> : No such file or directory
> 
> sudo script/server provides the same response  
> ls -la script/server returns:  
> -rwxr-xr-x 1 pogo admin 98 Nov 13 2006 script/server
> 
> I have all of 2 weeks experience on a Mac, which probably explains the  
> basic problem. Can someone advise?

What does your path look like? (in terminal: printenv PATH). The ./  
directory is not in their by default, so you would have to type  
something like ./script/server. To save yourself the trouble of having  
to do that each time, just add ./ to your path in your shell’s rc file:

In bash (and zsh, I believe):  
export PATH=.:$PATH

In tcsh:  
setenv PATH .:$PATH

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 7, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/3 "2007-06-07T17:11:46Z")

</div>

I’ve run into problems installing on OS X from source too. I found it  
much easier to install MAMP and Locomotive.

[http://locomotive.raaum.org/](http://locomotive.raaum.org/)  
[http://www.mamp.info/en/home/](http://www.mamp.info/en/home/)

MAMP launches Apache and MySQL and Locomotive launches Ruby on Rails.  
Both reside in the Applications folder with your other apps. The other  
advantage is that you can save your projects in the Documents folder.  
For me, that style has been easier to manage than the command-line.  
While I’m comfortable with the command line, I’m not a pro. Using this  
combination of applications, you’ll be up and running within a half  
hour.

Otherwise, this site has good notes on getting Ruby on Rails running  
via the command line:

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 7, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/4 "2007-06-07T17:13:47Z")

</div>

On Jun 7, 2007, at 10:55 AM, Mark wrote:

> sudo script/server provides the same response  
> ls -la script/server returns:  
> -rwxr-xr-x 1 pogo admin 98 Nov 13 2006 script/server
> 
> I have all of 2 weeks experience on a Mac, which probably explains the  
> basic problem. Can someone advise?

Try:  
ruby script/server

Then, if that works, look at the #! line at the top of the file (head  
-1 script/server)

Mine is:  
$ head -1 script/server  
#!/usr/bin/env ruby

If yours is something else, then add a line that says where to find  
your ruby. (particularly if the first line is not a #! unless you  
just want to explicitly use “ruby script/whatever …”

Also, your ruby is where: which ruby  
says it is based on your path.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 8, 2007, 7:18pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/5 "2007-06-08T19:18:53Z")

</div>

- Joshua B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2007-06-07 09:05]:

> What does your path look like? (in terminal: printenv PATH). The ./  
> directory is not in their by default, so you would have to type  
> something like ./script/server. To save yourself the trouble of having  
> to do that each time, just add ./ to your path in your shell’s rc file:

You don’t need to use ./ when you already have a directory name  
(‘script’ in this case) in the command.

‘script/server’ is the same as ‘./script/server’.

You only need ./ if you are already in the same directory as a command.

```
 cd script
 ./server

```

Also, adding ‘.’ to your PATH is generally a bad idea. You might end up  
running a command you didn’t expect.

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 8, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/6 "2007-06-08T19:23:33Z")

</div>

Grant Hollingworth wrote:

> You don’t need to use ./ when you already have a directory name  
> (‘script’ in this case) in the command.
> 
> ‘script/server’ is the same as ‘./script/server’.
> 
> You only need ./ if you are already in the same directory as a command.
> 
> ```
> cd script
> ./server
> 
> ```
> 
> Also, adding ‘.’ to your PATH is generally a bad idea. You might end up  
> running a command you didn’t expect.

Yeah…I’m not really sure what I was thinking (probably shouldn’t post  
before morning coffee…). As for the wisdom in adding ‘.’ to PATH, my  
rule of thumb has always been NEVER for root/superuser accounts,  
normally no for user accounts, but for dev accounts (where I’ll be  
compiling a lot of test code into directories not in PATH) it can be a  
bit of a time-saver. Oddly, though, I still end up typing  
‘./my\_ruby\_prog.rb’ half the time…

Cheers (and hope everything for the OP is working now!),

Josh

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [June 7, 2007, 5:31pm UTC](https://www.ruby-forum.com/t/rails-on-a-mac-so-strange-to-me-behavior/106211/7 "2007-06-07T17:31:28Z")

</div>

Tony Thomas wrote:

> I’ve run into problems installing on OS X from source too. I found it  
> much easier to install MAMP and Locomotive.
> 
> [http://locomotive.raaum.org/](http://locomotive.raaum.org/)  
> [http://www.mamp.info/en/home/](http://www.mamp.info/en/home/)

Yeah, I’ll throw my hat in with that suggestion. In fact, for the  
current Rails app I’m developing, I’ve got a flash drive with  
locomotive, textmate ([http://macromates.com/](http://macromates.com/)), css edit  
([Espresso — The Web Editor for Mac](http://macrabbit.com/cssedit/)), and my rails directory on it. If you  
change your dev environment to use SQLite3 then you can run (and  
showcase!) your app from any mac (honestly, I don’t know why anyone  
would go to the trouble of setting up a full blown MySQL DB just for  
development…testing and deployment I can understand, but for dev  
sqlite3 is just so attractive).

Really, I can’t say enough about this solution! In fact, if you throw  
one of the all-in-one rail packages for Widows or Linux on there, then  
you can develop anywhere.
