Tuesday, May 16, 2023

[Solved] Pressing enter produces ^M instead of a newline in the MAC/Linux


So while working on the Terraform and running terraform apply came across a issue where terraform was asking for the confirmation of yes and after entering yes , the terminal did took it as an Enter rather was printing  ^M every time pressed enter. Due to which the terraform apply wont work.


The most likely issue causing this is the stty terminal line setting. To resolve this issue lookout for the solution below.

Solution :-

Note:- since you not able to enter in my case, i pressed ctrl+z which move the process in background which resulted in the terraform lock not getting released and further increasing my problem due to which i have to go and unlock the state forcefully.

Better way is to go with ctrl+c which prevents the state locking.

To resolve this issue try entering the following command

stty sane

Once you enter this , the problem of Enter printing ^M instead should be solved. 


Post a Comment