I'm generating models in Ruby on Rails, and some of these tables have an awful lot of columns. What's maximum length of a command in Mac OS X?
2 Answers
The limit is not in bash but in your operating system. It's defined by the value of ARG_MAX
in your OS's limits.h
. You can get the value by running getconf ARG_MAX
. On my OSX 10.5 machine (and most other BSD systems) it's 262144. You can read more about this limit here.
-
1On Solaris 10, it is 1048320 - both are so big that they boggle the mind that someone might run out of it. Sep 29, 2009 at 2:53
-
-
1As of macOS 10.12, the limit is still 262,144 (256 KB). Note that the limit only applies when invoking external utilities, not shell builtins. Compare
echo "$(printf "%$(getconf ARG_MAX)s")"
to/bin/echo "$(printf "%$(getconf ARG_MAX)s")"
– mklementJan 17, 2017 at 17:54 -
-
@JonathanLeffler Searching through a few thousand files will quickly make that number very small.– ClearerApr 17, 2018 at 13:37
It depends on the shell, but the last time I ran a configure script using zsh on 10.6 it was 65535 characters.