ruby

Will Senn will.senn at gmail.com
Mon Mar 20 17:01:20 UTC 2023


bash_profile is executed for login shells, so it shouldn't be sourced 
more than once per login.

On 3/20/23 11:49 AM, chilli.namesake at gmail.com wrote:
> I was checking. echo $PATH reports correctly. If I source the 
> .bash_profile more than once, however, I get duplicates.
>
>> On Mar 20, 2023, at 12:44, Will Senn <will.senn at gmail.com> wrote:
>>
>> 
>> Sounds like you should check $PATH before and after the change to see 
>> what it's actually doing. Whatever you want to run, say your version 
>> of ruby in /some/dir/ruby, needs to appear earlier in the path than 
>> the system version, say /usr/bin/ruby... period. It's not rocket 
>> science. However, it's not totally straightforward, either. Some 
>> updated  command locations require that the shell be rehashed after 
>> changing the path cuz the shell may cache the location - hash -r, or 
>> equivalent. That said, it's usually pilot error messing with path.
>>
>> echo "PATH: $PATH"
>> before setting and after to see what's going on. then it's just a 
>> matter of figuring out which ruby comes first.
>>
>> Will
>>
>> On 3/20/23 11:33 AM, chilli.namesake at gmail.com wrote:
>>> This is the only way I can get it to work right without error
>>>
>>>> export 
>>>> PATH="$PATH:$HOME/bin:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
>>>
>>> It doesn't like :$PATH at the end
>>>
>>>
>>>> On Mar 20, 2023, at 09:27, chilli.namesake at gmail.com wrote:
>>>>
>>>> 
>>>> I am closer, but my $PATH is still messed up.
>>>>
>>>> This in .bash_profile
>>>>
>>>>> export 
>>>>> PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
>>>>
>>>> gets me this when I source it
>>>>
>>>>> *env: bash: No such file or directory*
>>>>> dude at mac:~/Extra/sand$ echo $PATH
>>>>> /Users/dude/bin:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
>>>>
>>>> notice the trailing ":"
>>>> removing it gets me a no such directory error for "/sbin$PATH"
>>>>
>>>>
>>>>> On Mar 20, 2023, at 09:04, Mark Anderson <emer at emer.net> wrote:
>>>>>
>>>>> 
>>>>> Yeah, this is the answer. You always want `/opt/local/bin/` to be 
>>>>> near the start of your path. Only stuff that you specifically want 
>>>>> to override MacPorts should be before it. (Examples of things you 
>>>>> may want before: RVM or NVM or any of the version managers that 
>>>>> put things in your home)
>>>>>
>>>>> Thanks,
>>>>> —Mark
>>>>> _______________________
>>>>> Mark E. Anderson <emer at emer.net>
>>>>> Find me on LinkedIn <https://www.linkedin.com/in/markemer/>
>>>>>
>>>>>
>>>>> On Sat, Mar 11, 2023 at 5:57 PM Austin Ziegler 
>>>>> <halostatue at gmail.com> wrote:
>>>>>
>>>>>     Change that to
>>>>>
>>>>>     export
>>>>>     PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/X11/bin:$PATH
>>>>>
>>>>>     -a
>>>>>
>>>>>>     On Mar 11, 2023, at 14:03, chilli.namesake at gmail.com wrote:
>>>>>>
>>>>>>     
>>>>>>     Thank you, I will check that
>>>>>>
>>>>>>     I have
>>>>>>
>>>>>>>     export
>>>>>>>     PATH=$PATH:$HOME/bin:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/X11/bin
>>>>>>
>>>>>>     in my .bash_profile, but echo $PATH shows what you expected:
>>>>>>
>>>>>>>     dude at mac:~$ echo $PATH
>>>>>>>     /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dude/bin:/opt/local/bin:/opt/local/sbin...
>>>>>>
>>>>>>     ok, I have something new to work out.
>>>>>>
>>>>>>>     On Mar 11, 2023, at 13:49, Austin Ziegler
>>>>>>>     <halostatue at gmail.com> wrote:
>>>>>>>
>>>>>>>     
>>>>>>>     No problem. The system ruby showing up instead of
>>>>>>>     MacPorts-installed Ruby would be *probably* because your
>>>>>>>     $PATH has `/opt/local/bin` *after* `/usr/bin`. Typically,
>>>>>>>     one wants to have Macports (or other third-party package
>>>>>>>     systems) *before* /usr/local/bin and /usr/bin.
>>>>>>>
>>>>>>>     -a
>>>>>>>
>>>>>>>     On Sat, Mar 11, 2023 at 1:46 PM chilli.namesake at gmail.com
>>>>>>>     <chilli.namesake at gmail.com> wrote:
>>>>>>>
>>>>>>>         
>>>>>>>
>>>>>>>>         root at mac:~$ ruby -S gem install coltrane
>>>>>>>>         ERROR:  Error installing coltrane:
>>>>>>>>         activesupport requires Ruby version >= 2.7.0.
>>>>>>>
>>>>>>>         Unfortunately, Mojave:
>>>>>>>         ruby 2.3.7p456 (2018-03-28 revision 63024)
>>>>>>>         [universal.x86_64-darwin18]
>>>>>>>
>>>>>>>         So I install ruby 2.7.7
>>>>>>>
>>>>>>>>         root at mac:~$ port -vsN install ruby27
>>>>>>>>         ....
>>>>>>>>         --->  Cleaning ruby27
>>>>>>>>         --->  Removing work directory for ruby27
>>>>>>>>         --->  Updating database of binaries
>>>>>>>>         --->  Scanning binaries for linking errors
>>>>>>>>         --->  No broken files found.
>>>>>>>>         --->  No broken ports found.
>>>>>>>>         --->  Some of the ports you installed have notes:
>>>>>>>>         ruby27 has the following notes:
>>>>>>>>         To make this the default Ruby (i.e., the version run by
>>>>>>>>         the 'ruby', 'gem' or 'bundle' commands), run:
>>>>>>>>         sudo port select --set ruby ruby27
>>>>>>>>         root at mac:~$ port select --set ruby ruby27
>>>>>>>>         Selecting 'ruby27' for 'ruby' succeeded. 'ruby27' is
>>>>>>>>         now active.
>>>>>>>>         root at mac:~$ ruby -S gem install coltrane
>>>>>>>>         ERROR:  Error installing coltrane:
>>>>>>>>         activesupport requires Ruby version >= 2.7.0.
>>>>>>>
>>>>>>>         grrr... it's still trying to use /usr/bin/ruby
>>>>>>>
>>>>>>>         but
>>>>>>>
>>>>>>>>         root at mac:~$ /opt/local/bin/ruby -S gem install coltrane
>>>>>>>
>>>>>>>         installed it.
>>>>>>>
>>>>>>>         idky my ruby $PATH seems stuck on /usr/bin/ruby, but
>>>>>>>         thanks to your tip, I was able to  install coltrane, and
>>>>>>>         it seems to be working. Neato CLI music utility.
>>>>>>>
>>>>>>>         Thank you, Austin!
>>>>>>>
>>>>>>>>         On Mar 11, 2023, at 13:14, Austin Ziegler
>>>>>>>>         <halostatue at gmail.com> wrote:
>>>>>>>>
>>>>>>>>         
>>>>>>>>         I don’t use Macports Ruby (I use `ruby-install`), but
>>>>>>>>         try this:
>>>>>>>>
>>>>>>>>         sudo ruby -S gem install coltrane
>>>>>>>>
>>>>>>>>         Ruby since Ruby 2.x has included Rubygems, and since a
>>>>>>>>         bit later than that, Bundler.
>>>>>>>>
>>>>>>>>         -a
>>>>>>>>
>>>>>>>>         On Sat, Mar 11, 2023 at 1:06 PM
>>>>>>>>         chilli.namesake at gmail.com <chilli.namesake at gmail.com>
>>>>>>>>         wrote:
>>>>>>>>
>>>>>>>>             Hi,
>>>>>>>>             I need a quick ruby primer, please.
>>>>>>>>
>>>>>>>>             I'd like to install this,
>>>>>>>>             https://github.com/pedrozath/coltrane
>>>>>>>>
>>>>>>>>>             sudo gem install coltrane
>>>>>>>>
>>>>>>>>             won't work because I'm on Mojave with an an ancient
>>>>>>>>             ruby and this requires ruby 2.7 or above.
>>>>>>>>
>>>>>>>>>             sudo port -vsN install ruby
>>>>>>>>
>>>>>>>>             installs ruby18 by default
>>>>>>>>
>>>>>>>>>             sudo port -vsN install ruby27
>>>>>>>>>             sudo port select --set ruby ruby27
>>>>>>>>
>>>>>>>>             installs, but gem still complains.
>>>>>>>>
>>>>>>>>             just guessing at this point:
>>>>>>>>>             port -vsN install rb-rubygems
>>>>>>>>
>>>>>>>>             reinstalls ruby18 ><
>>>>>>>>
>>>>>>>>
>>>>>>>>             Help, please.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>         -- 
>>>>>>>>         Austin Ziegler • halostatue at gmail.com>>>>>>>>         austin at halostatue.ca
>>>>>>>>         http://www.halostatue.ca/http://twitter.com/halostatue
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     -- 
>>>>>>>     Austin Ziegler • halostatue at gmail.comaustin at halostatue.ca
>>>>>>>     http://www.halostatue.ca/http://twitter.com/halostatue
>>>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20230320/ac0cd3ef/attachment.htm>


More information about the macports-users mailing list