I am beginning to learn Ruby ( vers. 1.8.6) , and I am using OS X (10.5.4), and accessing irb through terminal. On OS X, irb loads from a /etc/irbrc file that includes the 'simple prompt' code. I don't like the simple prompt, and am trying to create my own irbrc for irb to read when it logs in.
Firstly, the general instructions are to create a ~/.irbrc file, which I understand as an instruction to create a simple txt file, which I have called variously ".irbrc", "$irbrc", and " ".irbrc" ", and placed in a 'ruby' folder under my home directory (my 'mac' house on the finder)
I then put the code: IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I => "%N(%m):%03n:%i>
end
saved it, then exited terminal, restarted it, and logged back into irb.
STILL getting the simple prompt, and the 'double tab' auto-completion thing still works (also a part of the OSX etc irbrc file) so I know that irb is not reading my irbrc file.
What am I doing wrong? I've searched and searched, and I seem to be following the general instructions pretty well.
I am beginning to learn Ruby ( vers. 1.8.6) , and I am using OS X (10.5.4),
and accessing irb through terminal. On OS X, irb loads from a /etc/irbrc
file that includes the 'simple prompt' code. I don't like the simple
prompt, and am trying to create my own irbrc for irb to read when it logs
in.
Firstly, the general instructions are to create a ~/.irbrc file, which I
understand as an instruction to create a simple txt file, which I have
called variously ".irbrc", "$irbrc", and " ".irbrc" ", and placed in a
'ruby' folder under my home directory (my 'mac' house on the finder)
I then put the code: IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I =>
"%N(%m):%03n:%i>
end
saved it, then exited terminal, restarted it, and logged back into irb.
STILL getting the simple prompt, and the 'double tab' auto-completion thing
still works (also a part of the OSX etc irbrc file) so I know that irb is
not reading my irbrc file.
What am I doing wrong? I've searched and searched, and I seem to be
following the general instructions pretty well.
If you see "loaded" printed on the screen your rc file is correctly
read. If not, something with your irb or installation may be wrong or
you have an alias like alias irb='irb -f' (try "type -a irb" in bash).
I am beginning to learn Ruby ( vers. 1.8.6) , and I am using OS X (10.5.4),
and accessing irb through terminal. On OS X, irb loads from a /etc/irbrc
file that includes the 'simple prompt' code. I don't like the simple
prompt, and am trying to create my own irbrc for irb to read when it logs
in.
Firstly, the general instructions are to create a ~/.irbrc file, which I
understand as an instruction to create a simple txt file, which I have
called variously ".irbrc", "$irbrc", and " ".irbrc" ", and placed in a
'ruby' folder under my home directory (my 'mac' house on the finder)
I then put the code: IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I =>
"%N(%m):%03n:%i>
end
saved it, then exited terminal, restarted it, and logged back into irb.
STILL getting the simple prompt, and the 'double tab' auto-completion thing
still works (also a part of the OSX etc irbrc file) so I know that irb is
not reading my irbrc file.
What am I doing wrong? I've searched and searched, and I seem to be
following the general instructions pretty well.
--
remember.guy do |as, often| as.you_can - without end
The ruby folder IS in the 'home directory'. But I took it out and moved it directly in the 'mac' folder. It still doesn't work. Maybe I'm not understanding what a 'home directory' is. My understanding is that a home directory is my main folder for the user, i.e. my 'mac' house icon. That's where the txt file is.
I am beginning to learn Ruby ( vers. 1.8.6) , and I am using OS X (10.5.4),
and accessing irb through terminal. On OS X, irb loads from a /etc/irbrc
file that includes the 'simple prompt' code. I don't like the simple
prompt, and am trying to create my own irbrc for irb to read when it logs
in.
Firstly, the general instructions are to create a ~/.irbrc file, which I
understand as an instruction to create a simple txt file, which I have
called variously ".irbrc", "$irbrc", and " ".irbrc" ", and placed in a
'ruby' folder under my home directory (my 'mac' house on the finder)
It must be directly in the home directory.
I then put the code: IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I =>
"%N(%m):%03n:%i>
end
saved it, then exited terminal, restarted it, and logged back into irb.
STILL getting the simple prompt, and the 'double tab' auto-completion thing
still works (also a part of the OSX etc irbrc file) so I know that irb is
not reading my irbrc file.
What am I doing wrong? I've searched and searched, and I seem to be
following the general instructions pretty well.
Hey Thanks! That worked! And I quit terminal, restarted, and logged back into irb and it did it again. So, good stuff, and thanks for the, uh, "prompt" assistance.
I'm still wondering why it didn't load up automatically. Is it supposed to? All the info I read about .irbrc said that when irb is loading, it looks for those files automatically. What's up?
mac
···
On Feb 19, 2009, at 11:31 AM, Robert Klemme wrote:
I am beginning to learn Ruby ( vers. 1.8.6) , and I am using OS X (10.5.4),
and accessing irb through terminal. On OS X, irb loads from a /etc/irbrc
file that includes the 'simple prompt' code. I don't like the simple
prompt, and am trying to create my own irbrc for irb to read when it logs
in.
Firstly, the general instructions are to create a ~/.irbrc file, which I
understand as an instruction to create a simple txt file, which I have
called variously ".irbrc", "$irbrc", and " ".irbrc" ", and placed in a
'ruby' folder under my home directory (my 'mac' house on the finder)
I then put the code: IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I =>
"%N(%m):%03n:%i>
end
saved it, then exited terminal, restarted it, and logged back into irb.
STILL getting the simple prompt, and the 'double tab' auto-completion thing
still works (also a part of the OSX etc irbrc file) so I know that irb is
not reading my irbrc file.
What am I doing wrong? I've searched and searched, and I seem to be
following the general instructions pretty well.
Try this from a shell prompt (bash assumed):
echo 'puts "loaded"' >| ~/.irbrc
irb
If you see "loaded" printed on the screen your rc file is correctly
read. If not, something with your irb or installation may be wrong or
you have an alias like alias irb='irb -f' (try "type -a irb" in bash).
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
The ruby folder IS in the 'home directory'. But I took it out and moved it
directly in the 'mac' folder. It still doesn't work. Maybe I'm not
understanding what a 'home directory' is. My understanding is that a home
directory is my main folder for the user, i.e. my 'mac' house icon. That's
where the txt file is.
Hey Thanks! That worked! And I quit terminal, restarted, and logged back
into irb and it did it again. So, good stuff, and thanks for the, uh,
"prompt" assistance.
For what it's worth, you don't need to quit terminal. Just close irb
and start it back up.
I'm still wondering why it didn't load up automatically. Is it supposed to?
All the info I read about .irbrc said that when irb is loading, it looks
for those files automatically. What's up?
If what Robert suggested worked, then it *is* reading your .irbrc when
loading up.
Here's what you said you put in your ~/.irbrc in your original message:
IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I => "%N(%m):%03n:%i>
end
I can see a couple of problems here. It's possible that they're
copy/paste errors, but A) there's an opening curly brace right after
the first = and no closing curly and B) what's that end about?
If your ~/.irbrc is invalid, it will fail silently. My guess would be
that it reads /etc/irbrc first, then ~/.irbrc, so if there's a problem
with your ~/.irbrc, it would seem that it's not loading.
I''ll keep that 'failing silently' in mind. BTW, it WAS copy/pasted, and that particular one prompt code was the most complicated one I saw. I chose it after getting frustrated with a few other ones that didn't work. And if I had looked at it a little closer, I should have caught the missing second curly brace. It works though....
also, OS X is supposed to look for the /etc/irbrc file LAST, after looking through a few different spellings of /.irbrc. I still don't understand what happened, but the problem's solved, and I'll continue the trek.
thanks all for your know-how.
mac
···
On Feb 19, 2009, at 12:32 PM, Ben Bleything wrote:
I'm still wondering why it didn't load up automatically. Is it supposed to?
All the info I read about .irbrc said that when irb is loading, it looks
for those files automatically. What's up?
If what Robert suggested worked, then it *is* reading your .irbrc when
loading up.
Here's what you said you put in your ~/.irbrc in your original message:
IRB.conf[:PROMPT_MODE][:DEFAULT] = {:PROMPT_I => "%N(%m):%03n:%i>
end
I can see a couple of problems here. It's possible that they're
copy/paste errors, but A) there's an opening curly brace right after
the first = and no closing curly and B) what's that end about?
If your ~/.irbrc is invalid, it will fail silently. My guess would be
that it reads /etc/irbrc first, then ~/.irbrc, so if there's a problem
with your ~/.irbrc, it would seem that it's not loading.