Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails Tutorial - 5.26 - Sublime Text "Unable to Save" new file "spec/support/utilities.rb"

I am using Sublime Text 2 while following Michael Hartl's Ruby on Rails Tutorial.

The specific portion of the tutorial to which I am referring can be found at http://ruby.railstutorial.org/book/ruby-on-rails-tutorial (ctrl+F "Listing 5.26").

I am able to create the spec/support file. However, when trying to create the spec/support/utilities.rb file, I receive the message "Unable to save ~/rails_projects/sample_app/spec/support/utilities.rb".

Does anyone know why this might be?

Someone on the Sublime Text forum seems to have had the exact same problem: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8570&p=36922#p36922

like image 469
Matt Avatar asked Sep 13 '12 05:09

Matt


2 Answers

This issue sounds like it's a result of incorrect permissions or ownership of the folder. Change directories (cd) so you're outside of the folder where you're creating the .rb file and type:

ls -l

This terminal command lists the permissions attached to all files/folders in that directory. If "root" is listed as the folder owner, change its owner by typing:

sudo chown YOUR_COMP_USER_NAME FOLDER_NAME/

You should now be able to save files from inside that folder.

like image 198
knice Avatar answered Oct 13 '22 01:10

knice


To diagnose this, first find out if it's an issue in Sublime or your file system:

  • Does that file already exist? Try looking for it on your file system (not using Sublime).

  • Verify that you have permission to write to that file. Use "ls -la" on the command line to show the file permissions.

  • Are you able to create and/or save that file using any different editor, for example TextMate, or Notepad?

like image 33
joelparkerhenderson Avatar answered Oct 12 '22 23:10

joelparkerhenderson