If you need to use the Option / Alt key to enter certain characters (e.g. # @ | \) and you can’t do so in the terminal, follow the steps below.
From Preferences choose Terminal.
Under Terminal settings, disable Use Option as Meta key.
Navigate to Settings.
Under the Keyboard section, turn off Use Option as Meta key.
Please, note that this will allow you to enter characters with Option +, but will prevent from using any Meta + shortcuts in apps that support them. It’s not currently possible to map the Meta key to any other key other than Option.