34

This is really frustrating. I keep getting this error when trying to run a standard curl command:

curl --url https://install.meteor.com | sh
curl: (48) An unknown option was passed in to libcurl

Anyone know how to fix it?

Zaheer
  • 2,794
  • 5
  • 28
  • 33
  • Do you have any settings in a configuration file (`~/.curlrc`) or – Bruno Jul 26 '12 at 21:12
  • I can't seem to find that file. I don't think it exists on my computer. BTW I'm on OS X Mountain Lion – Zaheer Jul 26 '12 at 21:25
  • 1
    This happened to me after I changed `$LD_LIBRARY_PATH`, even though it was previously blank. If I set it back to nothing, curl would work again. My fix was to prepend `/lib64` (location of `libcurl.o` found with `ldd`) to `$LD_LIBRARY_PATH`, quite sure it's not the best solution though... – nyg May 06 '16 at 14:49
  • @nyg thanks ! this helped, "ldd /bin/curl" showed libcurl was taken from some other location. fixed easily by "export LD_LIBRARY_PATH=/lib64:$LD_LIBRARY_PATH" – thedrs Feb 03 '22 at 09:09

13 Answers13

72

Just had this exact issue with Alpine Linux.

The fix was to install curl-dev in addition to curl.

rix
  • 10,104
  • 14
  • 65
  • 92
  • 1
    How did you figure out that in addition you also had to install curl-dev? I am just asking this to become a better engineer. :) – Suhas Chikkanna Aug 28 '17 at 15:48
  • 1
    In all honesty it broke CI one day so I installed curl dev and didn't look into it any further. – rix Sep 27 '17 at 12:39
  • 2
    This was also the fix for me. It's related to AbhiNickz's answer regarding the version of libcurl. When you install curl-dev, it also installs an updated version of libcurl, that will now match the version of curl. Before, they mismatched. – BoomShadow Mar 19 '18 at 16:28
  • 1
    BoomShadow's comment is spot on. You can tell that the version mismatch between curl and libcurl is the main issue here by running `curl -V`. If libcurl has a different version than curl, then curl refuses to work properly and the problem arises. – Lucio Mollinedo Mar 29 '18 at 15:24
  • 4
    Alpine here, but for us an `apk update; apk upgrade` solved the issue. Thank you for sharing. – Daniele Vrut Apr 20 '18 at 09:45
24

Most likely you have a newer curl that uses an older libcurl that doesn't know of one or more options curl tries to use.

curl -V will show this and ldd [path to curl] will show you all shared libraries curl uses.

isomorphismes
  • 8,233
  • 9
  • 59
  • 70
Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222
14

I've just run into this problem myself. A bit of cursory research led me to this bug tracker entry, but updating didn't do the trick. I recently built the newest version of libcurl from source, though, so I figured it must be something to do with the directory structure getting mixed up. I'm sure you're probably not in the exact same situation, but perhaps Mountain Lion introduced a similar enough error that the steps I took to fix the problem might be able to help.

First, run which curl to determine where the binary is being called from. Then make sure that location actually exists by running locate -r /curl$. If it doesn't (this was the issue in my case), try running curl using all of the full paths provided by locate, ignoring the obviously superfluous ones like python-pycurl.

Once you've found one that works, you can either create a symlink to it from the one which found, or else check to see whether removing the latter will allow the shell to find the correct one on its own. For me, the fix was as simple as removing /usr/local/bin/curl, causing which curl to correctly respond with /usr/bin/curl and curl itself to return to normal operation.

andkerosine
  • 199
  • 1
  • 3
  • Thanks for the response. I ran which curl and the directory it specified did not exist. So I tried doing the locate command but i get: locate: illegal option -- r usage: locate [-0Scims] [-l limit] [-d database] pattern ... default database: `/var/db/locate.database' or $LOCATE_PATH – Zaheer Jul 27 '12 at 23:18
  • 1
    Ah, that's unfortunate. The `-r` flag allows you to specify a regular expression to better filter the results, but I guess you'll have to just run `locate curl` and scan through looking for paths that end with "/curl". As before, try running these in your shell using the full path; one of them *should* work, and then you can go from there. Also, try running `curl -V` as Daniel Stenberg suggested to ensure that your versions of `curl` and `libcurl` don't match. – andkerosine Jul 28 '12 at 00:17
  • 1
    Finally after a bunch of hacking around I was able to fix it. I deleted all the curl files and decided to start fresh. I downloaded curl from online and compiled it myself. I then ran into an error where when I tried running curl it would return `/usr/bin/curl: error: `/usr/bin/.libs/curl' does not exist This script is just a wrapper for curl. See the libtool documentation for more information.` Apparently when making curl it creates the curl file needed in `/usr/local/bin` rather than `/usr/bin`. `user/bin` is the mac default location for curl (and I had deleted it previously). – Zaheer Jul 28 '12 at 08:20
  • 2
    ...continuing I finally copied the curl file from `usr/local/bin` into `usr/bin` and it worked! What a nightmare. I hope this post helps someone else. – Zaheer Jul 28 '12 at 08:21
  • instead of removing, you can set an alias for it in .bashrc – Lord ST Jul 29 '17 at 15:09
14

If you just built your curl from source, run sudo ldconfig to fix it.

Kevin Murda
  • 191
  • 1
  • 7
8

This is the same error I was getting after installing cURL from source on Ubuntu.

$ curl http://www.google.com
curl: (48) An unknown option was passed in to libcurl

Looking at cURL's version showed that curl had updated but was using the old version of libcurl:

$ curl --version
curl 7.41.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3

To resolve my issue I copied libcurl.so and others from the latest curl folder which I downloaded and overwrote the ones already on my machine.

cp /tmp/curl-7.41.0/lib/.libs/libcurl.so* /usr/local/lib/

This fixed my issue.

$ curl --version
curl 7.41.0 (x86_64-unknown-linux-gnu) libcurl/7.41.0 OpenSSL/1.0.1 zlib/1.2.3.4

$ curl -I http://www.google.com
HTTP/1.1 302 Found
[...snip...]
ethicalhack3r
  • 1,062
  • 3
  • 15
  • 16
  • 1
    I'v copied all libcurl.a libcurl.la libcurl.so libcurl.so.4 libcurl.so.4.4.0 to the /usr/local/lib without success I still have the old libcurl with the new curl. curl 7.54.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 – Nicolas Manzini May 15 '17 at 08:54
4

This can be fixed by reinstalling cURL into /usr/bin instead of /usr/local/bin as Ubuntu 12.04 behaves weird when you install in different places

Also, this can be a possible fix, but be careful

ln -s /usr/bin/curl /usr/local/bin/curl

This means, the binary in /usr/local/bin isn't really the one the system is looking for or is outdated or cannot function properly. A simple symbolic link is required.


To be safe you might as well

mv /usr/local/bin/curl /usr/local/bin/curl.bak

before ln -s-ing the /usr/bin/curl version over.

isomorphismes
  • 8,233
  • 9
  • 59
  • 70
Vijay Kumar Kanta
  • 1,111
  • 1
  • 15
  • 25
  • Ta! This worked for me as well on Ubuntu 12.04 (after building `curl 7.48.0` from source). – isomorphismes May 09 '16 at 17:05
  • this worked on "Amazon Linux AMI 2018.03" instance has been up and running for years and found out curl was broken today, fully updated from packages, no curl install manually. – Jim Ford Oct 07 '22 at 18:38
4

I also got this error, but I'm not running Mountain Lion, and I wanted a simple, clean way to get it right for sure - on any system. (Note #1: I happen to be in a crouton Ubuntu/LXDE chroot on an old ARMv7 Chromebook.) (Note #2: I built the nightly release from source. I had no issue with installing curl the traditional way, i.e. sudo apt-get install curl.)

When I checked the version curl -V it showed my brand new nightly build version for curl: 7.51.1-20161107, but an old libcurl: 7.22...

I had a hunch this was the problem. I tried messing around with symbolic links, but it didn't work for me and I was only making a mess, so I consulted the official install page: https://curl.haxx.se/docs/install.html.

To force a static library compile, disable the shared library creation by running configure like:

./configure --disable-shared

So I ran the following from my curl source directory:

  1. sudo make uninstall
  2. ./configure --disable-shared
  3. make
  4. sudo make install

Now the curl version matches the libcurl version, and it works.

1

I had a similar problem (in Ubuntu 12.04). I manually installed curl in usr/local/bin and any command I type was giving curl:(48) An unknown option was passed in to libcurl

I fixed it uninstalling curl (sudo make uninstall) and installing it from apt-get (sudo apt-get install curl), which automatically placed curl in usr/bin. Then it worked!

PGreen
  • 3,239
  • 3
  • 24
  • 29
1

I faced the same issue on cygwin, when I manually built curl to work with https and everything was working fine

until one day I updated the curl package by running cygwin setup and didn't update the package libcurl4, and started getting the same error.

I checked curl version information by running:

$ curl -V
curl 7.54.1 (i686-pc-cygwin) libcurl/7.52.1 OpenSSL/1.0.2j zlib/1.2.8 libidn2/2.0.2 libpsl/0.17.0 (+libidn2/0.11) libssh2/1.7.0 nghttp2/1.14.0
Release-Date: 2017-06-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: Debug IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy Metalink PSL

So I found that cygwin updated the package curl to 7.54.1 but libcurl was still at 7.52.1

So I uninstalled the package curl and libcurl and reinstalled then everything was running fine again.

$ apt-cyg remove libcurl4 curl
Removing libcurl4
Package libcurl4 removed
Removing curl
Package curl removed

apt-cyg install curl libcurl4
Installing curl
curl-7.54.1-1.tar.xz: OK
Unpacking...
Package curl requires the following packages, installing:
cygwin libcurl4 libmetalink3 libopenssl100 zlib0
Package cygwin is already installed, skipping
Installing libcurl4
libcurl4-7.54.1-1.tar.xz: OK
Unpacking...
Package libcurl4 requires the following packages, installing:
ca-certificates cygwin libgcc1 libgssapi_krb5_2 libidn2_0 libnghttp2_14 libopenldap2_4_2 libopenssl100 libpsl5 libssh2_1 zlib0
Package ca-certificates is already installed, skipping
Package cygwin is already installed, skipping
Package libgcc1 is already installed, skipping
Package libgssapi_krb5_2 is already installed, skipping
Package libidn2_0 is already installed, skipping
Package libnghttp2_14 is already installed, skipping
Package libopenldap2_4_2 is already installed, skipping
Package libopenssl100 is already installed, skipping
Package libpsl5 is already installed, skipping
Package libssh2_1 is already installed, skipping
Package zlib0 is already installed, skipping
Package libmetalink3 is already installed, skipping
Package libopenssl100 is already installed, skipping
Package zlib0 is already installed, skipping
Package curl installed
Package libcurl4 is already installed, skipping

Checked curl version information again:

$ curl -V
curl 7.54.1 (i686-pc-cygwin) libcurl/7.54.1 OpenSSL/1.0.2j zlib/1.2.8 libidn2/2.0.2 libpsl/0.17.0 (+libidn2/0.11) libssh2/1.7.0 nghttp2/1.14.0
Release-Date: 2017-06-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS Debug IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy Metalink PSL
AbhiNickz
  • 1,035
  • 2
  • 14
  • 32
1

got this on macos, somehow curl got installed from homebrew and linked, solution was:

  • locate curl: which curl (/usr/local/bin/curl in my case)
  • remove it (unless it's already the /usr/bin one): rm /usr/local/bin/curl.

now which curl will give /usr/bin/curl

localhostdotdev
  • 1,795
  • 16
  • 21
0

On Ubuntu 16.04 LTS I just added /usr/local/lib to the LD_LIBRARY_PATH in /etc/profile (LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH)

0

Got into the same problem after having compiled from source over a packaged installation, solved it with the correct flags with configure :

./configure --prefix=/usr --libdir=/usr/lib64

Without the --libdir= option, mine was installing an updated version of libcurl into /usr/lib instead of /usr/lib64 and the new curl binary was still accessing the old libraries, leading to incompatibility.

-1

Drop the --url parameter:

curl https://install.meteor.com | /bin/sh

Anthony
  • 12,177
  • 9
  • 69
  • 105