On Jul 12, 2021, at 20:14, Jim DeLaHunt wrote: > On 2021-07-12 17:21, Ryan Schmidt wrote: > >> Correct, it's best to delete $(port work myport)/destroot prior to >> re-attempting the destroot phase, since portfile authors do not typically >> expect a destroot phase to be re-attempted and may not have written such >> destroot phases to work correctly if you do. >> >> If the destroot phase did not error but has instead been marked as >> completed, you can unmark that completion by editing the file $(port work >> myport)/.macports.myport.state and delete the line that reads "target: >> org.macports.destroot". >> >> I do these steps often. > > Awesome, Ryan! That is exactly what I was looking for. > > port -o -k install myport is my friend right now. bbedit $(port work > myport)/.macports.myport.state is my new friend.
Another trick I use when I am working on a port where it would mark a phase complete but I want to re-run that phase repeatedly after making changes is e.g. post-destroot { return -code error "something" } This forces MacPorts to emit an error at the end of the otherwise successful phase (in this case the destroot phase but you could use it for other phases) and not mark the phase as completed. This saves you from having to edit the state file when you want to rerun it.