-bash: fork: retry: Resource temporarily unavailable

If you are getting the above error in a Linux machine, you are probably hitting some resource limit in your shell. Every user in Linux has some limit on shell resources. You can check your resources limit with the following command:

ulimit -a

whose result may look like the following:

As you can see, the limit on “max user processes” is 1024, which means if I create more than 1024 processes, I might get the error : “-bash: fork: retry: Resource temporarily unavailable”.

To resolve the issue, you can temporarily increase the limit on the resource you have currently exhausted and then resolve the issue. Next time you log in to the machine, the resource you have increased will reset to its default value. You can modify the shell with the same commands that are shown in the figure. For example, if I want to increase the resource on “max user processes” to 2048, I can do so by running the following command:

ulimit -u 2048