die Hauptsache
main thing
The most important point or aspect of a matter.
Wir können über die Details später sprechen, die Hauptsache ist, dass wir uns einig sind.
We can talk about the details later; the main thing is that we agree.

main thing
Loading your saved state.
main thing
The most important point or aspect of a matter.
Wir können über die Details später sprechen, die Hauptsache ist, dass wir uns einig sind.
We can talk about the details later; the main thing is that we agree.

'Hauptsache' (main thing) is a compound noun made up of 'Haupt-' (meaning 'most important' or 'central') and 'Sache' (thing, matter). So it literally means 'the most important thing'.
Die Hauptstraße führt direkt durch das Stadtzentrum.
The main road leads directly through the city center.
There are two uses: as a noun with an article ('Die Hauptsache ist, ...' — the main thing is ...) and as a particle at the beginning of a sentence without an article ('Hauptsache, ...' — as long as ...). Both emphasize what is most important.
Die Hauptsache ist, dass niemand verletzt wurde.
The main thing is that no one was injured.
When a sentence begins with 'Hauptsache,', it is followed by a main clause with the verb in position two. This is an exception to the normal subordinate-clause structure.
Das Wetter ist schlecht. Hauptsache, wir haben Spaß!
The weather is bad. The main thing is that we're having fun!
The use of 'Hauptsache,' at the beginning of a sentence is very typical of spoken language and expresses a pragmatic attitude focused on what matters most.
Egal, wie teuer es war. Hauptsache, es gefällt dir!
It doesn't matter how expensive it was. As long as you like it!
The meaning 'central matter in dispute' is limited to the legal context. In everyday language, 'Hauptsache' is never used in this sense.
Der Anwalt konzentrierte sich in seinem Plädoyer auf die Hauptsache.
The lawyer focused on the main matter in his closing argument.
mainly
'hauptsächlich' and 'die Hauptsache' both have to do with importance, but grammatically they are not the same type of word. 'hauptsächlich' is an adverb and describes what something is mainly about or what makes up the largest part. 'die Hauptsache' is a noun and means the main thing or most important point. In the form 'Hauptsache, ...' (as long as...), you say that one condition is the most important thing. The words are easy to confuse because they look similar. In practice: 'hauptsächlich' describes an action or situation, while 'die Hauptsache' names the most important point.

Die Hauptsache ist, dass wir pünktlich ankommen.
The main thing is that we arrive on time.
In der Bibliothek habe ich hauptsächlich für die Prüfung gelernt.
At the library, I mainly studied for the exam.