When using the rsync via
rsync --delete --exclude=".._*" -vahE ~/Desktop /Volumes/BLUE/Sync/Desktop
command, as a result I'm getting this error
...
Desktop/Relax/quotes/._Screenshot 2020-12-29 at 09.11.03.png
Desktop/Relax/quotes/._Screenshot 2020-12-29 at 09.11.30.png
copyfile(.._Desktop.gTnUtf,./Desktop, COPYFILE_UNPACK) failed:45
sent 620.36K bytes received 798 bytes 248.46K bytes/sec
total size is 221.46M speedup is 356.53
rsync error: some files could not be transferred (code 23) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/main.c(996) [sender=2.6.9]
I tried the exclude pattern to get rid of .._Desktop.gTnUtf,./Desktop, but without success.
Any help?
This thread helped ...
So the solution I found is to install newer version of rsync what I did through brew.
Only one issue is that brew will not replace system package, but this is not a problem.
I ran brew info rsync and got the location of the command.
The problem is the option -E for rsync of Mac OS. If you use that option the rsync version that comes with Mac OS X doesn't allow you to exclude dotfiles. Without -E, the exclusion should work
rsync --delete --exclude=".._*" -vah ~/Desktop /Volumes/BLUE/Sync/Desktop
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'm trying to compile tesseract-ocr on my Mac 10.9 but It gets stock at:
libtool: link: (cd ".libs" && rm -f "libtesseract.dylib" && ln -s "libtesseract.3.dylib" "libtesseract.dylib")
It really takes a long time and I don't know if it is doing anything useful so is there any way I can get status of it's progress or at leas see what it is doing?
here is the lisf of commands I run to get here:
svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/ tesseract-ocr
cd tesseract-ocr
sh ./autogen.sh
./configure
make
By the way it takes my CPU activity very high that my MacBook fan is turned on. I'm also using iTerm as my shell.
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 )
How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different systems which I don't have control on).
For example if I start the Mercurial server locally doing a hg serve:
... $ hg serve
And then, from a Linux that has the wget command I do a wget:
... $ wget http://127.0.0.1:8000
--2010-12-31 22:18:25-- http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... 200 Script output follows
Length: unspecified [text/html]
Saving to: `index.html
And on the terminal in which I launched the "hg serve" command, I can indeed see that an HTTP GET made its way:
127.0.0.1 - - [30/Dec/2010 22:18:17] "GET / HTTP/1.0" 200 -
So on Linux one way to do an HTTP GET from a shell script is to use wget (if that command is installed of course).
What other ways are there to do the equivalent of a wget? I'm looking, in particular, for something that would work on stock OS X installs.
The following native command will work:
curl http://127.0.0.1:8000 -o outfile
Note that curl does not follow redirects by default. To tell it to do so, add -L to the argument list.
brew install wget
Homebrew is a package manager for OSX analogous to yum, apt-get, choco, emerge, etc. Be aware that you will also need to install Xcode and the Command Line Tools. Virtually anyone who uses the command line in OSX will want to install these things anyway.
If you can't or don't want to use homebrew, you could also:
Install wget manually:
curl -# "http://ftp.gnu.org/gnu/wget/wget-1.17.1.tar.xz" -o "wget.tar.xz"
tar xf wget.tar.xz
cd wget-1.17.1
./configure --with-ssl=openssl -with-libssl-prefix=/usr/local/ssl && make -j8 && make install
Or, use a bash alias:
function _wget() { curl "${1}" -o $(basename "${1}") ; };
alias wget='_wget'
Curl has a mode that is almost equivalent to the default wget.
curl -O <url>
This works just like
wget <url>
And, if you like, you can add this to your .bashrc:
alias wget='curl -O'
It's not 100% compatible, but it works for the most common wget usage (IMO)
1) on your mac type
nano /usr/bin/wget
2) paste the following in
#!/bin/bash
curl -L $1 -o $2
3) close then make it executable
chmod 777 /usr/bin/wget
That's it.
Use curl;
curl http://127.0.0.1:8000 -o index.html
Here's the Mac OS X equivalent of Linux's wget.
For Linux, for instance Ubuntu on an AWS instance, use:
wget http://example.com/textfile.txt
On a Mac, i.e. for local development, use this:
curl http://example.com/textfile.txt -o textfile.txt
The -o parameter is required on a Mac for output into a file instead of on screen. Specify a different target name for renaming the downloaded file.
Use capital -O for renaming with wget. Lowercase -o will specify output file for transfer log.
Instead of going with equivalent, you can try "brew install wget" and use wget.
You need to have brew installed in your mac.
You can either build wget on the mac machine or use MacPorts to install it directly.
sudo port install wget
This would work like a charm, also you can update to the latest version as soon as it's available. Port is much more stable than brew, although has a lot less number of formula and ports.
You can install MacPorts from https://www.macports.org/install.php you can download the .pkg file and install it.
You could use curl instead. It is installed by default into /usr/bin.
wget Precompiled Mac Binary
For those looking for a quick wget install on Mac, check out Quentin Stafford-Fraser's precompiled binary here, which has been around for over a decade:
https://statusq.org/archives/2008/07/30/1954/
MD5 for 2008 wget.zip: 24a35d499704eecedd09e0dd52175582
MD5 for 2005 wget.zip: c7b48ec3ff929d9bd28ddb87e1a76ffb
No make/install/port/brew/curl junk. Just download, install, and run. Works with Mac OS X 10.3-10.12+.