I am trying to set up a local Rails environment, and I am having issues with getting RVM installed.
Here is the error I get:
$ bash < <( curl http://rvm.io/releases/rvm-install-head )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 185 100 185 0 0 136 0 0:00:01 0:00:01 --:--:-- 0
bash: line 1: html: No such file or directory
bash: line 2: syntax error near unexpected token `<'
'ash: line 2: `<head><title>301 Moved Permanently</title></head>
The contents of my /usr/local folder are as follows:
bin man
etc mysql
hermes mysql-5.1.56-osx10.5-x86_64
include rvm
info share
lib
I have some working knowledge of what's going on here, but help on what I'm missing or whether I'm approaching this the wrong way would be greatly appreciated.
Use the new RVM installer for either user and/or root installs instead, it defaults to head.
user$ curl -L https://get.rvm.io | bash
Alternatively you can install the stable release like this:
user$ curl -L https://get.rvm.io | bash -s stable
RTFM material is located at https://rvm.io/rvm/install and https://rvm.io/rvm/basics
On my Mac OS X 10.5.8 I had to use
bash < <(curl -Lks https://rvm.io/install/rvm) or it failed silently.
The -s switch by itself absolutely does not work. Fails silently.
It's annoying when people answer with the generic info anyone can find at the RVM site. Please try to actually answer this when you've actually succeeded in installing ON A MAC.
Matt if my fix does not work for you then would you let us know? Thanks.
On mac 10.5 I had to run this command
$ echo insecure >> ~/.curlrc
followed by this
$ bash -s stable < <(curl -Lks --insecure https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
I hope this is helpful to someone out there.
You are missing the -s option to curl.
bash < <(curl -s https://rvm.io/releases/rvm-install-head )
Related
I run the command source ~/.bash_profile and get the following error:
$ source ~/.bash_profile
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: syntax error near unexpected token `<'
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: ` done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")'
The login shell that I use is bin/sh:
Whats the issue here and how to solve it?
This is how I solved the issue with the provided steps:
Install Homebrew from the docs on their homepage
Install Git using Homebrew (optional, but nice to have a more up-to-date git)
brew install git
Now install bash:
brew install bash
Add this install of bash to the allowed shells list:
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
Finally, change your shell to use this new one:
chsh -s /usr/local/bin/bash
Open a new terminal window/tab, and run these commands to double-check your work:
$ echo $SHELL
/usr/local/bin/bash
$ echo $BASH_VERSION
5.1.8(1)-release
This also solved the issue for running the source ~/.bash_profile whenever I open a new window in the terminal.
Reference:
The answer is from here How do I install Bash >= 3.2.25 on Mac OS X 10.5.8? by user jeffbyrnes
I'm trying to run one script (which installs and setups Postgres DB) from another script (test.sh). The problem is that the script which is called inside my script is remote (online on GitHub) and it doesn't work.
I tried to call the script three different ways.
locally - works
remotely using bash <(curl... - raises error
remotely using curl ... | bash -s - downloads script and hangs...
test.sh
#!/bin/bash
# this works correctly (it's the same but local)
sudo bash postgres/setup.sh
# this raises "bash: /dev/fd/63: No such file or directory"
sudo bash <(curl -s https://raw.githubusercontent.com/milano-slesarik/sh-ubuntu-instant/master/postgres/setup.sh)
# this hangs
curl https://raw.githubusercontent.com/milano-slesarik/sh-ubuntu-instant/master/postgres/setup.sh | sudo bash -s
The last one probably downloads the script but then hangs...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1532 100 1532 0 0 8281 0 --:--:-- --:--:-- --:--:-- 8281
Do you know how to make it work?
I want my scripts to be online so I don't have to clone/download then all the time.
The reason why it hangs when you run curl -s $script |bash -s seems to be a misbehaviour in the script itself, at least as long as you run it like that. You can debug this by adding the -x flag to the bash command. Then you can see the following message spawning in an endless loop, due to the while statement contained in the script:
++ read -p 'Do you wan'\''t to install postgres? [y/n]: ' yn
++ case $yn in
Also, as long as you are running the script this way, to avoid this behaviour I would remove those lines in which the script is expecting some kind of user input. If that is not the case, the easiest way is just to download it via curl and then run it locally from your terminal.
This may achieve what you wanted :
sudo bash -c "bash <(curl -s https://raw.githubusercontent.com/milano-slesarik/sh-ubuntu-instant/master/postgres/setup.sh)"
I keep getting an error when trying to configure Datastax Enterprise (my first Cassandra cluster) on Google Cloud Platform, specifically when following the tutorial here:
DataStax Enterprise Deployment Guide for Google Compute Engine - Manual
ssh into new machine called customizer
When I copy and paste the script, or completely retype the script on pico or vi (script found under "Create a customized OS image") and try to run it I get the error ./customizer.sh: line 21: syntax error near unexpected token 'newline' because of this line:
patch --backup /usr/share/google/safe_format_and_mount < #MOUNT_OPTIONS="discard,defaults" > MOUNT_OPTIONS="defaults,discard,noauto,noatime,barrier=0"
SFAM
Any idea what this line should look like to not get this error? When I try to remove the < and > the terminal gets hung up and i have to ctrl+c to get out.
Here is the full script:
#!/bin/bash
#This script can be applied to a running GCE instance
#to prep it for running DSE on SSD based storage, assumed
#to be mounted at /dev/sdb. After this script has been applied,
#a GCE image can be created accordin to the instructions at the
#Image creation guide: https://developers.google.com/compute/docs/images#creatingimage
#Base OS list: https://developers.google.com/compute/docs/operating-systems#backportsimages
apt-get update
apt-get install -y less htop patch libjna-java sysstat iftop binutils pssh pbzip2 zip unzip openssl curl liblzo2-dev ntp git python-pip tree unzip dstat ethtool
#Don't need to disable swap
#Disable Swap
#swapoff -a
#Need to mount SSD
mkdir -p /var/lib/cassandra
#https://developers.google.com/compute/docs/disks#formatting
#/usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F"
patch --backup /usr/share/google/safe_format_and_mount < #MOUNT_OPTIONS="discard,defaults"
> MOUNT_OPTIONS="defaults,discard,noauto,noatime,barrier=0"
SFAM
patch --backup /etc/rc.local < echo deadline > /sys/block/sdb/queue/scheduler
> echo 0 > /sys/block/sdb/queue/rotational
> blockdev --setra 0 /dev/sdb
> /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/sdb /var/lib/cassandra
>
END
cat >> /etc/sysctl.conf <
Thanks for pointing this out and sorry for the inconvenience - this is actually an issue with our documentation. Some of the characters were stripped out when we moved to a new content management system. We are in the process of fixing this as soon as possible.
In the meantime, please use this latest deployment guide for deploying Datastax Enterprise to Google:
https://academy.datastax.com/demos/deployment-guide-google
Replace line 21 and 22 with the following:
From
patch --backup /usr/share/google/safe_format_and_mount < #MOUNT_OPTIONS="discard,defaults"
> MOUNT_OPTIONS="defaults,discard,noauto,noatime,barrier=0"
to this (note that this is still 2 lines):
patch --backup /usr/share/google/safe_format_and_mount
> MOUNT_OPTIONS="defaults,discard,noauto,noatime,barrier=0"
or this (note that this 1 lines would replace 21 and 22):
patch --backup /usr/share/google/safe_format_and_mount < MOUNT_OPTIONS="defaults,discard,noauto,noatime,barrier=0"
The reason for the error is because the end of line 21 is commented out (everything after the # symbol) so it is technically ending in the < character... which is used for command substation.
I am trying to install Rex on Mac OS X (El Capitan), following the instructions at https://www.rexify.org/get.html
I have installed XCode and MacPorts.
Below are the responses I got from the installation commands now
$ sudo port install libssh2 perl5
---> Computing dependencies for libssh2
---> Cleaning libssh2
---> Computing dependencies for perl5
---> Cleaning perl5
---> Scanning binaries for linking errors
---> No broken files found.
$ curl -L https://get.rexify.org | perl - --sudo -n Rex
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 294k 100 294k 0 0 99k 0 0:00:02 0:00:02 --:--:-- 99k
Rex is up to date. (1.3.3)
Although the install scripts told me it's up to date, I cannot run the command:
$ rex
-bash: rex: command not found
I have tried on another Mac OS X machine and there was no problems. Could someone help me to fix this weird situation?
Update:
Doing a $ find / -name rex, I found one instance in /opt/local/libexec/perl5.22/sitebin/. Did the installer make some mistakes when creating the bin folder?
You need to find out where the perl modules are installed on your system using
perl -e 'print join "\n", #INC;'
You will find rex in one of the perl module directories in the subdirectory "bin".
Try this:
for PERLINC in $(perl -e 'print join "\n", #INC;')
do ls -l $PERLINC/Rex-1.3.3/bin/rex; done
So I've run into a bit of a problem. I've found many similar problems with spaces in $HOME, but the fixes do not apply to spaces in $USER - so I'm posting a question here.
Due to regulations at work my username for my workstation consists of +space+ (cannot be changed), for instance: John Doe
This is my $USER:
$ echo $USER
john doe
When I try to install rvm I get the following error:
It looks you are one of the happy *space* users(in home dir name),
RVM is not yet fully ready for it, use this trick to fix it:
sudo ln -s "/Users/john doe/.rvm/" /john doe.rvm
echo "export rvm_path=/john doe.rvm" >> "/Users/john doe/.rvmrc"
However, when I try to run the first command I get the following error:
ln: doe.rvm: No such file or directory
And if I attempt to run
sudo ln -s "/Users/john doe/.rvm/" "/john doe.rvm"
I get:
ln: /john doe.rvm: File exists
Any help would be tremendously appreciated :-)
Edit
sudo ln -s "/Users/john doe/.rvm/" /john\ doe.rvm
yields
ln: /john doe.rvm: File exists
Edit 2
Okay, thanks to platzhirsch I no longer get an error message when running the ln command. Now the problem is following:
When I run
echo "export rvm_path=/john\ doe.rvm" >> "/Users/john doe/.rvmrc"
or
echo "export rvm_path="/john doe.rvm"" >> "/Users/john doe/.rvmrc"
I get the following error when trying to re-install:
usage: dirname path
Edit 3
I've also tried manually editing the .rvmrc file. This is what it looks like:
export rvm_path="/john doe.rvm"
I've also tried
export rvm_path=/john\ doe.rvm
With no luck, I still get:
usage: dirname path
When I try to run
\curl -L https://get.rvm.io | bash -s stable --ruby
this message is fixed with https://github.com/wayneeseguin/rvm/issues/2140 - just start again and now it will propose the directory with _ (underscore) instead of (space)
why don't try to escape the white space ?!
sudo ln -s "/Users/john\ doe/.rvm/" "/john\ doe.rvm"
See this pst about escaping in linux shell. It is (almost) the same if you are using a terminal on a mac