If you get the following error while trying to install something via Homebrew

AttributeError: 'int' object has no attribute 'split' - make: *** [sharedmods] Error 1

The solution to this Homebrew issue

First try to solve the actual Homebrew issues:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

This will then allow you to update:

homebrew update

Then:

brew tap aws/tap
brew install aws-sam-cli

Worst case scenario solution

Then you can solve it like this:

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
brew doctor
brew update

How the error looks

==> Installing dependencies for aws/tap/aws-sam-cli: [email protected]
==> Installing aws/tap/aws-sam-cli dependency: [email protected]
==> ./configure --prefix=/usr/local/Cellar/[email protected]/3.8.6_2 --enable-ipv6 --datarootdir=/usr/local/Cellar/[email protected]/3.8.6_2/share --datadir=/usr/local/Cellar/python
==> make
Last 15 lines from ~/Library/Logs/Homebrew/[email protected]/02.make:
    self.run_command(cmd_name)
  File "/private/tmp/[email protected]/Python-3.8.6/Lib/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/private/tmp/[email protected]/Python-3.8.6/Lib/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/private/tmp/[email protected]/Python-3.8.6/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "./setup.py", line 320, in build_extensions
    self.detect_modules()
  File "./setup.py", line 1695, in detect_modules
    self.detect_readline_curses()
  File "./setup.py", line 930, in detect_readline_curses
    (tuple(int(n) for n in dep_target.split('.')[0:2])
AttributeError: 'int' object has no attribute 'split'
make: *** [sharedmods] Error 1